Skip to content

Instantly share code, notes, and snippets.

@janzikmund
Last active April 26, 2021 07:38
Show Gist options
  • Save janzikmund/258966b35cf3c7dc20ccaa52ce6dd4a8 to your computer and use it in GitHub Desktop.
Save janzikmund/258966b35cf3c7dc20ccaa52ce6dd4a8 to your computer and use it in GitHub Desktop.
redirect-non-www-http-to-www-https.htaccess
# Redirect from non-www or http to https www
<IfModule mod_rewrite.c>
RewriteEngine On
# exclude acme challenge urls from rewriting to not mess Let's Encrypt
RewriteRule ^\.well-known\/acme-challenge\/ - [L]
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.jandhqualitykitchens.com.au/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment