简体   繁体   English

从codeigniter-2删除index.php

[英]Removing index.php from codeigniter-2

I am having problems removing index.php from codeigniter-2. 我在从codeigniter-2删除index.php时遇到问题。 I remember using the same code before too & it worked perfectly fine, but it is not working on codeigniter-2. 我记得以前也使用过相同的代码,并且工作得很好,但是在codeigniter-2上不起作用。

I have checked the documentation & this question too, still of no help. 我也检查了文档这个问题,仍然没有帮助。

My .htaccess code is as follows: 我的.htaccess代码如下:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]

replace /index.php with /site_folder_name/index.php everywhere & be sure that your server supports mod_rewrite /index.php替换为/index.php/site_folder_name/index.php 确保您的服务器支持mod_rewrite

Your new code should look like: 您的新代码应如下所示:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /site_folder_name/index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /site_folder_name/index.php?/$1 [L]

RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ /site_folder_name/index.php/$1 [L]

try this: 尝试这个:

RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

you have to re-write the .htaccess file for this. 您必须为此重写.htaccess文件。

maximum server work with this 与此最大的服务器工作

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

in godaddy server i have to write this. 在godaddy服务器中,我必须编写此代码。 sometimes it works with above code in godaddy server. 有时,它可以与Godaddy服务器中的上述代码一起使用。

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1

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

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