Need to redirect all traffic to https

This works for me: RewriteEngine on RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} If the traffic is coming in over non-SSL HTTP, then redirect to the HTTP equivalent of whatever page the user was originally trying to access. It also doesn’t involve any mod_rewrite options, so it’s easy to read. Side rant: why does everyone feel … Read more

How to do htaccess redirect based on cookie value

This works for a cookie like id=1234: RewriteEngine on RewriteCond %{HTTP_COOKIE} ^id=([0-9]*)$ [NC] RewriteRule .* http://localhost/mysite/cache/%1 [R=301,L] RewriteRule .* http://localhost/mysite/cache/guest [R=301,L] Now for your problem: Make sure that your htaccess does not apply to the page you rewrite to! For example, if your .htaccess lies in /mysite/.htaccess It will be used again in http://localhost/mysite/cache/%1 That’s … Read more