Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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.

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.


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:

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

The above rule will redirect all your HTTP traffic (http://yourdomain.com) to HTTPS (https://yourdomain.com).

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.



This post first appeared on Web Hosting Blog - Web Hosting Discussion, please read the originial post: here

Share the post

Redirect HTTP to HTTPS rewrite rule

×

Subscribe to Web Hosting Blog - Web Hosting Discussion

Get updates delivered right to your inbox!

Thank you for your subscription

×