Skip to content

Instantly share code, notes, and snippets.

@taricco
Created May 31, 2020 00:29
Show Gist options
  • Select an option

  • Save taricco/ec6c21b92fc4c6f9847b5f44cdeb5bdd to your computer and use it in GitHub Desktop.

Select an option

Save taricco/ec6c21b92fc4c6f9847b5f44cdeb5bdd to your computer and use it in GitHub Desktop.
RewriteEngine On
# Force WWW
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=302,NC]
# Force HTTPS/SSL
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment