In this article we will learn how to HTTPS for WordPress websites by .htaccess.
The method to make your WordPress based website to run always on https.
1. Login into wp-admin and go to “Settings -> General”. Make sure the URL have https.
2. From the file manager, edit your .htaccess and replace the WordPress rules by the following code:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
# Rewrite HTTP to HTTPS
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.hostnextra.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Note: Replace hostnextra.com by your domain name. Make sure the position of the https Rewrite rule is same as mentioned above.
And it’s done!