Skip to content

Instantly share code, notes, and snippets.

@mmansion
Created November 5, 2018 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmansion/5bebce127e296b38d96019ac5301e698 to your computer and use it in GitHub Desktop.
Save mmansion/5bebce127e296b38d96019ac5301e698 to your computer and use it in GitHub Desktop.
.htaccess redirect for https (ssl certificate)
#handles both HTTP and www canonical redirects
# change the "302" to "301" only after you are sure it's working
RewriteEngine On
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment