我已更改
$config['index_page'] = 'index.php';
到
$config['index_page'] = '';
还有
$config['uri_protocol'] = 'REQUEST_URI';
到
$config['uri_protocol'] = 'AUTO';
,并且在.htaccess
中,我编写了此代码。但是index.php
无法从URL
中删除。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
答案 0 :(得分:1)
将您的base_url
设置为
$config['base_url'] = 'http://localhost/base_folder/
使用此.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /base_folder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>