我已经尝试了很多答案,但不断遇到好的 ol,404 恐怖墙。我在 Windows 7 上使用 xamp 堆栈。 mod_rewrite 已启用。
我把htaccess文件放在主“codeigniter”目录下,也就是有application、system和user_guide的目录。我应该把它放在应用程序目录下吗?带有 View /模型/配置/等的那个?
这是我当前的 .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]
正在访问 http://localhost/website/codeigniter/index.php/welcome作品 正在访问 http://localhost/website/codeigniter/welcome没有
我的config.php有
$config['base_url'] = 'http://localhost/website/codeigniter/';
$config['index_page'] = '';
非常感谢任何帮助!
错误是:
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
更新 哦,只是想查看 apache 日志,得到这个错误:
[Thu Mar 08 18:28:25 2012] [error] [client ::1] File does not exist: C:/xampp/htdocs/website/codeigniter/welcome
所以它似乎没有选择正确的 codeigniter 重定向?不确定?
最佳答案
首先创建 .htacess 文件并粘贴下面的代码 RewriteEngine 开启
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
然后进入配置文件
$config['index_page'] = 'index.php';
改为
$config['index_page'] = '';
享受
关于php - 从 xampp 的 codeigniter 中删除 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9619831/