Reputation: 12244
I'm building a preprod environment where the client and developpers will be able to check that everything is working fine for their website they are about to put up but i must disable all HTTPS redirection because at this point it would fall in the PROD site wathever the HOSTNAME is sent in the request.
This is one of the examples i'm using:
RewriteCond %{HTTP_HOST} (www\.)?domain\.com
RewriteCond %{HTTP_HOST} ^s\.domain\.com
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/?basket/$
RewriteCond %{REQUEST_URI} !^/?basket/add/
RewriteCond %{REQUEST_URI} !^/?basket/delete/
RewriteCond %{REQUEST_URI} !^/?basket/modify/
RewriteCond %{REQUEST_URI} !^/?basket//add/
RewriteCond %{REQUEST_URI} !^/?basket//delete/
RewriteCond %{REQUEST_URI} !^/?basket//modify/
RewriteCond %{REQUEST_URI} !^/?basket/info_panier.js
RewriteRule ^/?basket/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Problem is, even if i visit:
http://s.domain.com/basket//coordonnees/login/
It still redirects me to the HTTPS version, but i have a rewrite condition on the s.domain.com saying to skip this rule... What am i doing wrong?
CrazyCoder
Upvotes: 4
Views: 22954
Reputation: 12244
Never mind i found it two seconds later, but this might help other people:
The condition:
RewriteCond %{HTTP_HOST} (www\.)?domain\.com
Came clashing on the condition:
RewriteCond %{HTTP_HOST} ^s\.domain\.com
Because i didn't put a ! off the start. If i put ! before the (www.)?domain.com it will not match s.domain.com and thus work fine...
Upvotes: 5