Page 1 of 1

Problem with www. and none www.

Posted: Fri Mar 07, 2014 11:09 pm
by ultraspoon
Hi there,

I am wondering if anyone could offer any assistance with my issue please.

When accessing the website via www.example.com I get a blank page. When I remove the www. the website then loads fine, then I click on a category and a blank page again. I have to remove the www. each time to load each page.

As far as I know the DNS records are setup fine, as I was on the phone to my host today. There are no rewrite rules in the .htaccess file and the config files all look correct.

Where should I start looking to try and figure this out?

Thank you

Re: Problem with www. and none www.

Posted: Thu Mar 20, 2014 5:04 pm
by butte
If there are no rewrite rules, then one of them should have DNS A pointing to the machine address of the server, and one of them should have either the same for local redirection from its own directory or instead DNS CNAME pointing to the other one by name (not by machine address). For example (here spaced to nullify live links):

DNS A for www. whee.com = nnn.nnn.nnn.nnn
where host account specifies disc location

DNS CNAME for non-www. = www. whee.com
where non-www. takes on persona of www.
or
DNS A for non-www. = nnn.nnn.nnn.nnn
where host account specifies disc location

At registrar level (the registrar where you registered your domain), you set at least NS values for nameservers (NS), which may be the registrar's own or may be the webhost's nameservers or maybe somewhere else. If the webhost is also the registrar it will have two "hats" -- registrar role and webhost role. Wherever that appointed set of 2-4 or so nameservers is, you set DNS records (A, CNAME, and for mail MX). Those are set for each domain, each subdomain. At webhost level (which can be a still third outfit), you "host" your domains and subdomains, which ordinarily wind up in the account root or their own directories. In those root and other directories, they can be redirected, using the host control panel's redirection feature or using .htaccess file(s). Traffic direction overall goes through the registrar first and then the appointed (delegated) nameservers to the webserver(s) and mailserver(s). Once that pattern "propagates" world wide, then the entire world does not pass through the registrar, but nameservers world wide do look at the registrar. The "authority" for traffic direction is from the top downward, registrar, designated nameservers, etc..

Re: Problem with www. and none www.

Posted: Thu Mar 20, 2014 6:27 pm
by willows
Beware google treats http://yourstore.com and http://www.yourstore.com as seperate sites.

So be careful not to kill your ranking of moving from http://yourstore.com to http://www.yourstore.com

If you are moving you will need to 301 redirect to preserve all ranking as best as possible. This is done in the .htaccess file.

Re: Problem with www. and none www.

Posted: Thu Mar 20, 2014 11:22 pm
by Johnathan
Yes, you should always have one version redirected to the other. Otherwise you'll encounter issues, especially with ajax, as it appears to be two different domains. You can try this code in your htaccess file:

Code: Select all

# Redirect www to non-ww
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 
If that doesn't work then Google "htaccess redirect www to non-www".

Re: Problem with www. and none www.

Posted: Fri Mar 21, 2014 1:50 am
by butte
We neglected to ask your OC version.

How long has this thing even been up and running? If it is longstanding, and has been non-www., then, yes, you can either keep it that way or instead use the google tools to "change address" gracefully while you also redirect non-www. to www.. If it is new, then you might as well favor www. and redirect non-www. to www. (reverse of what Johnathan suggested, send "htaccess redirect non-www to www" through Google).