我读过关于移除它的指南,他们告诉我将它添加到我的htdocs根目录下的.htaccess中:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
然而,我的网站目录是这样的: htdocs\mywebsite\
我尝试在htdocs和我的网站中添加htaccess文件,但是没有结果。我还尝试修改最后一行代码,如下所示
RewriteRule ^(.*)$ mywebsite/index.php/$1 [L]
在htdocs和我的网站目录中。但是我不知道什么是正确的.htaccess语法,也不知道它是如何工作的,所以我真的不希望它能工作。
我还尝试过修改codeigniter目录树中其他所有位置的.htaccess文件。
发布于 2012-11-26 18:26:22
你见过这个吗?How to remove "index.php" in codeigniter's path
您是否更改了配置文件中的index_path变量?这是2.1.3版本中的application/config/config.php,第29行
发布于 2012-11-26 19:43:45
根目录和网站目录中都需要有一个htaccess文件。它们都需要包含相同的内容,除了根目录中的文件需要更新到索引的路径以包括您的网站目录。
根目录:
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ yourwebsite/index.php/$1 [QSA,L]
Web目录:
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [QSA,L]
发布于 2012-11-26 18:36:29
确保您的虚拟主机条目中包含以下内容:
<Directory "/path...to directory">
Order allow,deny
Allow from all
Allowoverride all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
</IfModule>
除了根目录外,您不需要修改任何.htaccess文件。如上所述,确保在config.php文件中进行了正确的设置。
https://stackoverflow.com/questions/13570750
复制相似问题