Created
October 22, 2020 09:41
-
-
Save rakeshsoni18/11fcff1b3ef1ad2e0c86985d4daeb01f to your computer and use it in GitHub Desktop.
Redirect HTTPS Through .htaccess
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
# Forcing HTTPS on All Traffic | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Forcing HTTPS on a Specific Domain | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^yourdomain1.com [NC] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# Forcing HTTPS on a Specific Folder | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(folder1|folder2|folder3) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment