Redirect HTTP to HTTPS rewrite rule

As you know Google announced that they will consider SSL factor in their serach algorithm. That means, if you have SSL certificate for your website, it may get benefit in search ranking.

WHMCS Complete Billing and Support

Today, we will discuss, how can we redirect all HTTP request to HTTPS. Before you follow this article, you will have to ensure that you have installed SSL certificate for your website and it is working properly. If you have still not purchased an SSL certificate, you can purchase it from third party provider like Namecheap etc.

Redirect HTTP to HTTPS
In this article, we will consider that you are using Apache web server and mod_rewrite is supported on your web server. You can use the following .htaccess rule to redirect all your HTTP traffic to HTTPS:

The above rule will redirect all your HTTP traffic ( to HTTPS (

It is essential that you use R=301 in the above rewrite rule. This will set 301 redirection for HTTP to HTTPS hence your old URLs will automatically updated by search engine.

Posted in Apache.

Leave a Reply

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