Created
February 27, 2020 21:43
-
-
Save chetanmadaan/faebde5ca8bd0b0e08462c3428419743 to your computer and use it in GitHub Desktop.
.htaccess redirect thingy.
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
# Redirect HTTP with www to HTTPS with www | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP_HOST} ^www\. [NC] | |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# Redirect HTTP without www to HTTPS with www | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# Redirect HTTPS without www to HTTPS with www | |
RewriteCond %{HTTPS} on | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
## 301 Redirects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment