您好成功删除了我的网址中的index.php,但[controller folder]/[function]/[argument]
不再有效
这是我的htacess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
我也改变了这个
$config['uri_protocol'] = 'REQUEST_URI';
$config['index_page'] = '';
这是我的配置['base_url']
$base = "http://".$_SERVER['HTTP_HOST'];
$base .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base;
我已经在apache中更改了我的http.conf AllowOverride All
我已经重启了我的xampp,Cna有人帮我解释为什么[controller folder]/[function]/[argument]
无效?
答案 0 :(得分:1)
将.htaccess脚本更新为:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /codeigniter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css|docs|js|system)
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
答案 1 :(得分:1)
RewriteEngine On
RewriteBase /codeigniter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteBase / [文件名]。
答案 2 :(得分:1)
使用它来避免更改RewriteBase
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>