我在root的子文件夹中安装了codeigniter,访问我的应用程序的当前URL如下:
http://www.site.com/subfolder/index.php/controller/action
我想从网址中删除index.php
,因此我创建了一个.htaccess
文件,文件如下所示;
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteBase /subfolder
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我也编辑了
$config['index_page'] = 'index.php';
要:
$config['index_page'] = '';
和
$config['uri_protocol'] = 'root';
要:
$config['uri_protocol'] = 'REQUEST_URI';
然后我尝试了网址:
www.site.com/subfolder/controller/action
但它显示了一个Not found
错误页面,当我将网址编辑为:
www.site.com/subfolder/?/controller/action
答案 0 :(得分:0)
尝试像这样改变你的.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /subfolder/index.php/$1 [L]