Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question
    
I didn't want too many complex details, so I didn't mention my attempt to use CloudFlare's "rules" to redirect the root to "www". –  Ari Sep 6 '12 at 20:23
    
Why not setup the CNAME from your registrar? Unless you registered the domain with 1&1 –  Anagio Nov 26 '12 at 3:49
    
Yes, and 1&1 doesn't allow Cnames unless you're hosting with them. If I can't fix it, I can transfer to a better registrar I guess. –  Ari Nov 26 '12 at 4:02
    
I would try and get your domain setup on GoDaddy, avoid CloudFlare and see if that's the cause –  Anagio Nov 26 '12 at 4:07
    
you may want to install HTTP Live headers in firefox or an equivalent plugin in Chrome and view the headers live. You may see which redirect is causing the http to go to https –  Anagio Nov 26 '12 at 5:40
add comment

1 Answer

up vote 1 down vote accepted
+50

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.

share|improve this answer
    
Thanks! I had a Cloudflare rule redirect to 'www' but it was only working for the root, so I added a pattern matching which fixed the issue. Not sure why the HTTPS was popping up. –  Ari Nov 26 '12 at 22:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.