Codeigniter: website have too many redirects

2019-05-24 08:49发布

问题:

I have developed a webportal in codeigniter framework,but when i try to host in a shared hosting server i will get this error.

wwww.abc.com redirected you too many times. ERR_TOO_MANY_REDIRECTS

I don't know what was the problem

Here is my .htaccess file

RewriteEngine on
# Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteCond %{REQUEST_URI} ^application.*[NC]
        RewriteRule (.*?)index\.php/*(.*) $1$2 [R=301,NE,L]

# Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?/$1 [L]

UPDATE I have contacted with hosting support team ,they said that it was a mode security error. Here the log about it.

ModSecurity: Access denied with redirection to http://spotmyticket.com/ using status 302 (phase 4). Pattern match "^5\\d{2}$" at RESPONSE_STATUS. [file "/usr/local/apache/conf/modsec_vendor_configs/OWASP/rules/RESPONSE-50-DATA-LEAKAGES.conf"] [line "14"] [id "970901"] [rev "3"] [msg "The Application Returned a 500-Level Status Code"] [data "Matched Data: 500 found within RESPONSE_STATUS: 500"] [severity "ERROR"] [ver "OWASP_CRS/3.0.0"] [maturity "9"] [accuracy "9"] [tag "Host: spotmyticket.com"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-information disclosure"] [tag "WASCTC/WASC-13"] [tag "OWASP_TOP_10/A6"] [tag "PCI/6.5.6"] [hostname "spotmyticket.com"] [uri "/index.php"] [unique_id "VxpEf2f3YKwABUKkyP4AAABb"]

回答1:

DirectoryIndex index.php
RewriteEngine on                       
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]