Welcome Guest, Not a member yet? Register   Sign In
htaccess redirects
#2

[eluser]CroNiX[/eluser]
Yes, your CI rules should be dead last in your htaccess, after any other redirects or other manipulation take place.

Otherwise, if you go to "yoursite.com/anypage", it hits the first rules dealing with CI. So it then passes the request to CI, which processes it. Now it comes to your force www rule and says "oops", no www, redirect the whole thing to www and start over.
Code:
RewriteEngine On
#Force WWW
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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


Messages In This Thread
htaccess redirects - by El Forum - 07-16-2012, 07:07 AM
htaccess redirects - by El Forum - 07-16-2012, 10:20 AM
htaccess redirects - by El Forum - 07-16-2012, 10:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB