Skip to content

Instantly share code, notes, and snippets.

@MaraScott
Last active October 30, 2020 12:00
Show Gist options
  • Save MaraScott/e29dd2df722cd44d1b506709ed717ba0 to your computer and use it in GitHub Desktop.
Save MaraScott/e29dd2df722cd44d1b506709ed717ba0 to your computer and use it in GitHub Desktop.
Redirect non ssl to ssl
RewriteEngine On
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^.*$ https://www.domain.tld%{REQUEST_URI} [R,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment