Skip to content

Instantly share code, notes, and snippets.

@eder-dias
Created August 3, 2017 21:43
Show Gist options
  • Save eder-dias/e6570ebdbacb3015738295f57c571fc5 to your computer and use it in GitHub Desktop.
Save eder-dias/e6570ebdbacb3015738295f57c571fc5 to your computer and use it in GitHub Desktop.
Redirect from non-www to www and HTTP to https.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoururl.com [NC]
RewriteRule ^(.*)$ http://www.yoururl.com/$1 [L,R=301,NC]
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment