Redirect HTTPS to HTTP for Any Homepage

redirect_https_http_htaccess_apache

Recently there was a saddle change with all modern browsers. As of a few months ago, most major browsers which include Internet Explorer, FireFox and Chrome will now prefer HTTPS over HTTP if you partially fill out the domain name and hit ENTER. Most websites will load just fine, however even for eCommerce websites there is no good reason to load the Homepage securely with HTTPS. In fact, it will way down and use more server side resources and increase the likelihood of lost business when a spike in traffic will occur.

A simple and effective solution is to force a 301 redirect on the homepage of your website from HTTPS to HTTP. We can achieve that with very little code, 2 lines to be exact. To redirect your homepage from HTTPS to HTTP add these lines to your .httaccess or the httpd.conf file:

The main reasons why these lines work best:

  1. Easy copy and paste into any apache configuration file (as long as mod-rewrite is turned on).
  2. Will work for any domain name. With ‘www’ or without, etc.
  3. Is restricted to only affect the homepage, hence lowering the likelihood of other issues popping up when you are running larger websites or advanced frameworks like Magento or WordPress.

Enjoy. Let me know if there is any way to improve it.