Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created October 18, 2011 11:16
Show Gist options
  • Save wheresalice/1295188 to your computer and use it in GitHub Desktop.
Save wheresalice/1295188 to your computer and use it in GitHub Desktop.
Ensure people are using the www subdomain and https. This could be optimised, but it's nice to be able to switch out parts
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
php_value session.cookie_secure 1
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment