我的登录 Controller :$this->load->view('login-view');
模板中重定向到“login-view”的链接是:anchor('login','Login');
在从 codeigniter 中的 url 中删除 index.php 之前效果很好。但是从 url 中删除 index.php 后它就不起作用了。
我的 .htaccess 文件是:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
我想很难解释,这就是我所拥有的。 :(
最佳答案
在 .htaccess 中尝试一下
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
并在config.php
$config['uri_protocol'] = 'AUTO';
关于codeigniter - 从 codeigniter 中的 url 中删除 index.php 后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14029243/