Skip to content

Instantly share code, notes, and snippets.

@parvez
Created March 29, 2012 11:24
Show Gist options
  • Save parvez/2236108 to your computer and use it in GitHub Desktop.
Save parvez/2236108 to your computer and use it in GitHub Desktop.
Force HTTPS with Rewrite Rule
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://www.mydomain.com%{REQUEST_URI} [L,R]
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^.*$ https://www.mydomain.com%{REQUEST_URI} [L,R]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment