简体   繁体   English

在CodeIgniter中删除index.php

[英]Remove index.php in CodeIgniter

I'm trying to remove the 'index.php' from CI Urls. 我正在尝试从CI Urls中删除“ index.php”。

I've tried many solutions, none of them worked. 我尝试了许多解决方案,但都没有解决。 I've already set these variables in 'config.php': 我已经在“ config.php”中设置了这些变量:

$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";

And my current .htaccess is: 我当前的.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]

The www prefix part works fine. www前缀部分工作正常。 But the 'index.php' part doesn't. 但是'index.php'部分却没有。 If you want to check the webpage, here is it: http://www.plugb.com/index.php/home 如果要查看网页,请访问: http : //www.plugb.com/index.php/home

Take your application folder out of the system folder and use this code: 将您的应用程序文件夹移出系统文件夹,并使用以下代码:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder_name/index.php/$1 [L]

It should work. 它应该工作。

《 CodeIgniter用户指南 》的“ URL”部分中的 “删除index.php文件”部分下有关于如何执行此操作的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM