Created
October 9, 2019 21:14
-
-
Save SalmanRavoof/d8400b3122c4ad1c83675ade264d6432 to your computer and use it in GitHub Desktop.
Alternative way to force any HTTP request to redirect to HTTPS by adding the first three lines to your WordPress .htaccess file. The next bit is WordPress' way of handling Pretty Permalinks.
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
RewriteEngine On | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L,NE] | |
# Please make sure to replace the example.com domain name in line 3 with your own | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# END WordPress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment