Reputation: 135
So I migrated my app from one host to another. Most of the app works through 'pretty urls' where /login.php becomes /login (which I access in my php through $_SERVER['REQUEST_URI'] ), however after switching hosts my htaccess code for this doesn't work anymore (chrome gives me a redirect loop error).
This is the code:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
Any idea what could be wrong?
Upvotes: 0
Views: 127
Reputation: 669
If you want to redirect HTTP to HTTPS:
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1
If you want to redirect HTTPS to HTTP:
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1
Upvotes: 2