删除CodeIgniter中的index.php
我正在尝试从 CI 网址中删除“index.php”。
我尝试了很多解决方案,但没有一个有效。我已经在“config.php”中设置了这些变量:
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
我当前的 .htaccess 是:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^plugb.com$ [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [R=301,L]
RewriteCond $1 !^(index\.php|files|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
www 前缀部分工作正常。但“index.php”部分没有。如果你想查看网页,这里是: http://www.plugb.com/索引.php/home
I'm trying to remove the 'index.php' from CI Urls.
I've tried many solutions, none of them worked. I've already set these variables in 'config.php':
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
And my current .htaccess is:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^plugb.com$ [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [R=301,L]
RewriteCond $1 !^(index\.php|files|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
The www prefix part works fine. But the 'index.php' part doesn't. If you want to check the webpage, here is it: http://www.plugb.com/index.php/home
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将您的应用程序文件夹从系统文件夹中取出并使用以下代码:
它应该可以工作。
Take your application folder out of the system folder and use this code:
It should work.
有关如何执行此操作的说明,请参阅 CodeIgniter 用户指南的 URL 部分 “删除index.php 文件”部分。。
There's instructions on how to do this in the URLs Section of the CodeIgniter User Guide under the section "Removing the index.php file".