Root Domain Redirects Incorrectly To Https instead of to WWW

Root Domain Redirects Incorrectly To Https instead of to WWW - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Root Domain Redirects Incorrectly To Https instead of to WWW error on your web browser. Problem :


Why do visits to my website work without "www", but not to specific pages on it?



I recently moved my website to a new webhost, RedHat's OpenShift (a PAAS). It requires using Cname records to setup custom domains, something my domain name registar (1&1) does not support without a hosting plan. So instead I setup Cloudflare in-between my domain and web host, and setup a Cname record on it. I then pointed a 1&1 "www" sub-domain to CloudFlare, and then pointed my 1&1 root to "www" sub-domain.



This works fine for visiting to my homepage, but for some reason it does not work when visiting a specific page without "www". Instead of adding "www", it goes to HTTPS, which is strange.


Solution :

Looking at the HTTP headers is key. You can use this tool:
http://www.rexswain.com/httpview.html
Or you can use curl at the command line:



curl -I http://zappable.com/2012/11/chart-for-learning-a-programming-langauge/
HTTP/1.1 302 Found
Server: cloudflare-nginx
Date: Mon, 26 Nov 2012 21:36:52 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: https://zappable.com/2012/11/chart-for-learning-a-programming-langauge/
Set-Cookie: __cfduid=db936b1575b9f27157d63fbcc2bd7a99b1353965811; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.zappable.com


You will see here that Cloudlflare is returning a Location directive that is causing the redirect. This could be:




  1. Some CloudFlare rewrite or security rule is causing the redirect.

  2. Your source server is sending the redirect due to incorrect re-write
    rules.



I suspect #2.



This appears to be WordPress, so make sure you have not accidentally set https somewhere in WP for the default URL.



I would also check any rewrite rules to see if they are forcing the HTTPS redirect. If your server sends the redirect then CloudFlare will simple cache it.



To test OpenShift directly, you can put CloudFlare in bypass mode or change your local host file to point to the IP that your side resides on.



You can then use curl to check the headers and find the re-direct.


We hope that this article has helped you resolve the redirects, subdomain, cname error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=