Skip to content

Instantly share code, notes, and snippets.

@iloris
Forked from parvez/htaccess
Created June 13, 2012 22:21
Show Gist options
  • Save iloris/2926839 to your computer and use it in GitHub Desktop.
Save iloris/2926839 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