从 xamp 中的 codeigniter 中删除 index.php

Org*_*cat 3 php xampp .htaccess codeigniter

我已经尝试了很多答案,但不断遇到好的 ol,404 恐怖之墙。我在 Windows 7 上使用 xamp 堆栈。mod_rewrite 已启用。

我把htaccess文件放在主“codeigniter”目录下,即有application、system和user_guide的目录。我应该把它放在应用程序目录下吗?具有视图/模型/配置/等的那个?

这是我当前的 .htaccess 文件:

RewriteEngine On

# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/

RewriteBase /website/codeigniter/

# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule .* index.php/$0 [PT] 
Run Code Online (Sandbox Code Playgroud)

访问http://localhost/website/codeigniter/index.php/welcome有效 访问http://localhost/website/codeigniter/welcome无效

我的 config.php 有

$config['base_url'] = 'http://localhost/website/codeigniter/';
$config['index_page'] = '';
Run Code Online (Sandbox Code Playgroud)

非常感谢任何帮助!

错误是:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

Error 404
Run Code Online (Sandbox Code Playgroud)

更新 哦,只是想查看 apache 日志,得到这个错误:

[Thu Mar 08 18:28:25 2012] [error] [client ::1] File does not exist: C:/xampp/htdocs/website/codeigniter/welcome
Run Code Online (Sandbox Code Playgroud)

那么它似乎没有选择正确的 codeigniter 重定向?没有把握?

ras*_*111 5

首先创建 .htacess 文件并将以下代码粘贴到 RewriteEngine 上

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)

然后转到配置文件

$config['index_page'] = 'index.php';
Run Code Online (Sandbox Code Playgroud)

改成

$config['index_page'] = '';
Run Code Online (Sandbox Code Playgroud)

享受