无法从 url 中删除 index.php
couldn't remove index.php from url
我正在使用 CodeIgnitor 3.0.0。我已经阅读了很多关于同一问题的问题,但似乎都不适合我,目前 htaccess 代码取自 CI 文档(我也尝试了这里给出的不同答案中的各种 .htaccess 代码)并且还检查了代码与重写库。这是我的 .htaccess 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]
我也检查了我的 config.php 文件很多次,因为一些答案建议这样做
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
而且我还检查了 Xampp 中的 write_mode 是否也打开了,它有
AllowOverride All
跟默认路由有关系吗?
$route['default_controller'] = 'welcome';
如果需要任何其他文件,请告诉我。我已经花了一天时间,任何帮助将不胜感激
谢谢
在你的 codeigniter 中这样做
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project_name/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/ [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
我正在使用 CodeIgnitor 3.0.0。我已经阅读了很多关于同一问题的问题,但似乎都不适合我,目前 htaccess 代码取自 CI 文档(我也尝试了这里给出的不同答案中的各种 .htaccess 代码)并且还检查了代码与重写库。这是我的 .htaccess 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]
我也检查了我的 config.php 文件很多次,因为一些答案建议这样做
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
而且我还检查了 Xampp 中的 write_mode 是否也打开了,它有
AllowOverride All
跟默认路由有关系吗?
$route['default_controller'] = 'welcome';
如果需要任何其他文件,请告诉我。我已经花了一天时间,任何帮助将不胜感激 谢谢
在你的 codeigniter 中这样做
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project_name/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/ [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>