HTTPS Version URL Serving Different Website Than HTTP [Problem Solution]

https-and-http-serving-different-website

A few days back when I searched on Google ‘site:gulshankumar.net’, I shocked to see the Google SERPs as there was appearing any other URDU language website over HTTPS version on my domain. The website was completely different from my HTTP version domain.

After thinking a lot, I got a solution which I want to share in in this article.

The story and concept behind the solution

Initially, for inspecting the hosting detail in depth, I reversed IP address to look all other websites which were hosted at same shared hosting.

Later, I came to know that all website were hosted on the same IP had the same issue, in that group of all domains I found there was only one website where were using SSL Certificate. And, that particular site got copied by rest all another site which was not using HTTPS version or SSL.

I thought if this issue is just due to the absence of SSL why not redirect HTTPS to HTTP over Cloudflare Flexible SSL service.

My Preferred Solution to this problem

Without wasting any more time, I installed free Cloudflare CDN to mask my website IP address and to use Flexible SSL. After then, I added this code in my root .htacceess file to redirect all HTTPS request to HTTP protocol.

# Force all HTTPS request to HTTP via Cloudflare
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Later, when I checked my website after few mins, It was successfully redirecting to HTTPS to HTTP. Hence, my problem got resolved.

If you are facing the same issue, after visiting your website in HTTPS version; you also might be getting Certificate error in Google Chrome.

There are issues with the site’s certificate chain (net::ERR_CERT_COMMON_NAME_INVALID).

To fix, I’d suggest just Install Cloudflare CDN, and set proper redirection from HTTPS to HTTP via.htaccess as I have mentioned above.

What can you learn from this?

  • Never host your website at cheap web hosting company.
  • Cloudflare is ultimate solution of so many critical problems.

Related Story

If you find this post useful for yourself, please share on social media. If you have any query, please let me know in the comment section.
Thanks

Subscribe our blog via Email
Get instant updates of our new blog post directly at your Mailbox.

Add a Comment

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

By commenting on this article, you agree to our .