【发布时间】:2013-01-08 12:10:17
【问题描述】:
我知道这已经被问过很多次了,但是以前的解决方案/答案都不起作用。
我看过这些:
- Remove index.php From URL - Codeigniter 2
- mod_rewrite to remove index.php from Codeigniter in subdirectory
- Using htaccess to remove codeigniter index.php in a subdirectory
我过去曾成功使用过这些解决方案,但这次安装给我带来了问题。我认为这可能不仅仅是.htaccess 问题。
说明
我的文件夹设置如下:/home/~username~/public_html/~company~/index.php。我的 $config['index_page'] 设置为 "" 并且我的服务器启用了 mod_rewrite。我正在使用CI version, 2.1.3
.htaccess 文件与application 文件夹位于同一文件夹中。
问题
如果应用程序中断,我似乎无法从我的 URL 中删除 index.php。我尝试了很多很多 .htaccess 设置,包括 CI 网站上提供的设置。
我很茫然。如果不是我的.htaccess 文件,它会是什么?如果是我的.htaccess 文件,我做错了什么?我最近的尝试是:
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php) [NC]
RewriteRule ^(.*)$ /home/username/company/index.php/$1 [L] //absolute path
and
""
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ company/index.php/$1 [L]
完整的apache 错误:
[Thu Jan 24 18:22:13 2013] [error] [client ip ]
File does not exist: /home/username/public_html/company/home
【问题讨论】:
-
1.你说你“90%肯定”。你可以使用
apache_get_modules()或100% 确定的东西吗? 2. 你的 RewriteRule 缺少 public_html,是故意的吗? -
1.我运行了该功能,它确实已安装。 2.我尝试了public_html,没有,没有区别。
-
您能否发布从 URL 中删除 index.php 时收到的确切错误消息? (它可能在 apache 错误日志或 CI 应用程序日志中。)
-
我无权访问 apache 日志,CI
application/log只有一个空的index.html文件。 -
这可能与您主机的 apache 设置有关,但如果不看到错误,调试起来会非常困难。
标签: php .htaccess codeigniter