简体   繁体   English

从URL Codeigniter 1.7.2中删除index.php

[英]Remove index.php from URL Codeigniter 1.7.2

I have moved my codeigniter project and all the related databases from old server (Centos 5.11) to new server (Centos 6.7). 我已经将我的codeigniter项目和所有相关数据库从旧服务器(Centos 5.11)移到了新服务器(Centos 6.7)。 In the old server, the task of removing the index.php from URL was already handled with the help of the .htacess files and other changes. 在旧服务器中,已经从.htacess文件和其他更改的帮助下完成了从URL中删除index.php的任务。 I have moved the entire project on the new server without making any changes. 我将整个项目移到新服务器上,没有进行任何更改。 When I visit the main page of the project ie the login page it works fine and gets displayed without any issue. 当我访问项目的主页(即登录页面)时,它可以正常工作,并且可以毫无问题地显示出来。 But the moment I login, I get a 404 error page. 但是,当我登录时,出现了404错误页面。 But when I add index.php fragment at the required place then it works! 但是,当我在所需位置添加index.php片段时,它就可以工作! Did moving the project to latest server version cause a problem? 将项目移动到最新的服务器版本是否引起问题?

 RewriteEngine On
 Options All

 #php_flag display_errors Off
 #php_value error_reporting 1
 #php_value post_max_size 8M
 #php_value upload_max_filesize 8M
 #php_value memory_limit 150M
 # These settings when uncommented, giving 500 Internal Server Error on 
 # the new server http://119.18.48.12

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule ^/(.*).php         /uat/index.php/$1.php [L,NC]
RewriteRule ^/(.*).php          index.php/$1.php [L,NC]

#Local Server Setting
#RewriteRule ^admin/(.*)            administration.php/$1 [L,NC]
#LIVE Server setting
RewriteRule ^admin/(.*)         /uat/administration.php/$1 [L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#Local Server Setting
#RewriteRule ^(.*)$             index.php/$1 [L]
#LIVE Server setting
RewriteRule ^(.*)$          /uat/index.php/$1 [L]
Options -Indexes 
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
        #RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC] 
        #RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC] 
        #RewriteRule \.(jpe?g|gif|bmp|png)$ - [F]
</IfModule>  
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
<IfModule mod_headers.c>
Header add Cache-Control:  "no-store, no-cache, must-revalidate"
Header unset Pragma
FileETag None
Header unset ETag
</IfModule>
#End Gzip
# BEGIN Expire headers  
<ifModule mod_expires.c>  
    ExpiresActive On  
    ExpiresDefault "access plus 5 seconds"  
    ExpiresByType image/x-icon "access plus 2592000 seconds"  
    ExpiresByType image/jpg "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"  
    ExpiresByType image/gif "access plus 2592000 seconds"  
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType text/html "access plus 600 seconds"  
    ExpiresByType text/css "access plus 604800 seconds"  
    ExpiresByType text/javascript "access plus 216000 seconds"  
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"  
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType application/javascript "access plus 216000 seconds"  
    ExpiresByType application/x-javascript "access plus 216000 seconds"  
    ExpiresByType application/xhtml+xml "access plus 600 seconds"  
</ifModule>

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

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