[英].htaccess is not working in codeigniter
我已经开始使用codeigniter并希望将URL /testing_palace/index.php/home
中的index.php
删除到/testing_palace/home
/testing_palace/index.php/home
/testing_palace/home
,在本地主机上工作。
我用Google搜索了问题,并尝试了建议的解决方案,但对我没有用。
我将config中的base_url
和index页面更改为
$config['base_url']= 'http://localhost/testing_palace/';
$config['index_page'] ="";
并在Windows apache上选中了mod_rewrite
。
这是我的.htaccess代码
RewriteEngine On
RewriteBase /testing_palace
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
所有这些解决方案都无法为我找到错误。
使用以下.htaccess。
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
我认为它将为您提供帮助。
让您的/testing_palace/.htaccess
像这样:
RewriteEngine on
RewriteBase /testing_palace/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
然后在/testing_palace/application/config/config.php
您需要具有以下配置设置:
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.