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 ^(.*)$$1 [R=301,L]

IMPORTANT: Change 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.

Leave a Reply

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

Get more tech stuff like this
in your inbox

Subscribe to our mailing list for occasional amazing tech stuff.

Thank you for subscribing.

Something went wrong.