Created
August 9, 2023 13:23
-
-
Save anova/1e75558ff6c36f950ba3d427df0c5a45 to your computer and use it in GitHub Desktop.
Enforce SSL and www with one redirect. Change example.com with your domain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/36986520 | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} example\.com$ | |
RewriteCond %{HTTPS} off [OR] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule (.*) https://www.example.com%{REQUEST_URI} [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment