Skip to content

Instantly share code, notes, and snippets.

@jennimckinnon
Last active March 6, 2018 02:24
Show Gist options
  • Save jennimckinnon/8a6ab1b68d0f9a5674d8 to your computer and use it in GitHub Desktop.
Save jennimckinnon/8a6ab1b68d0f9a5674d8 to your computer and use it in GitHub Desktop.
Add 301 redirect to force SSL on site
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L]
</IfModule>
@sabernhardt
Copy link

to make the redirect permanent:
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L]

@jennimckinnon
Copy link
Author

jennimckinnon commented Mar 6, 2018

I got that from the Codex back when I wrote the article. It looks like they make significant updates to that page since then. I have updated it. Thanks for catching that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment