Make Website Redirect to Https

If you  have correctly installed an SSL certificate on your website, you may think that it should automatically make all pages accessible through https. However, this is not the case, especially with WordPress.

You have to carry out a small tweak on your website to force all pages be accessible through https.

The whole process involves editing the.htaccess file in your file server. You need to edit the file by adding either of the following codes:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

IMPORTANT: Change www.example.com in the code above to your own website URL.

In most cases, the above will work. However, if it doesn’t work, you can remove the code and replace it with the following:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

There we go. Adding either of the above two lines of code will make your website automatically redirect a visitor to access any of your site’s page through https rather than http.

Have any question? Write them in the comment section below.

Written By
I Cozens
More from I Cozens

InMotion Hosting Complaints [MY UNBIASED REVIEW]

Late last year, I signed up for InMotion Hosting. It was during...
Read More

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.