How to redirect all website traffic to https

https traffic is gaining traffic all over the web. After a successful SSL certificate installation, it is a very good idea (for security and SEO purposes) to redirect all the web traffic to the https:// protocol.

To achieve this, you need to create the .htaccess file in the public_html folder of your hosting account – if it doesn’t exist already.

Add the following code to the .htaccess file:

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

OR

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

Do well to test the traffic once done.

Was this article helpful?

Related Articles

Leave A Comment?

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