Created
August 9, 2023 11:01
-
-
Save kikmedia/a4cf8b11d78e9e34133b1725b97cc38f to your computer and use it in GitHub Desktop.
rewrite snippets apache
This file contains 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
## force www domain | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L] | |
## rewrite everything which is not the correct domain | |
RewriteCond %{HTTP_HOST} !^www\.example\.com$ | |
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment