Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've just changed my web hosting and edited my nameservers, etc. and uploaded the website onto the new hosting servers. This all went fine and without any problems. However, when testing the live site I found that is working but just typing redirects back to the old server/website (which is closing down later on today).

I was just wondering what the issue is here and if/when the new site will show up when typing in the address without the www?

I'll be the first to admit that I know very little about this www. vs no-www. so any help with this would be greatly appreciated and I'd like to know the best way of setting my domains up so that all of my sites are consistent.

share|improve this question
Are you sure this is not just a DNS propagation issue ? Possible Cache on your computer. – Analog Jan 17 '14 at 10:14
It sounds like the A record for the non-www ( DNS record is either pointed to the old IP address, or as Analog stated, hasn't propagated yet or is still in your DNS cache. First clear the cache in your OS (or use online site checks), then if still not resolving, use online DNS health tests to see if the A record is pointed to the correct IP or not. – dan Jan 17 '14 at 16:04
I think the first thing to do is to download the current .htaccess file (in your root page server directory) and look at it, and also perhaps share it here. – Eliptical view Jan 17 '14 at 18:44

3 Answers 3

The most effective way to handle this would likely be to add the www redirect in the .htaccess at the root of the new website (create the file if it doesn't exist) providing you're on an Apache server.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

This will 301 redirect all no-www URL's to the www URL's across your website.

share|improve this answer
Correct me if I'm wrong, but if this is a DNS issue, it will never get to this redirect? – Ivo van der Veeken Jan 17 '14 at 11:10
It's not a DNS issue if if the website loads at the www version of the URL and only not the non www. – zigojacko Jan 17 '14 at 12:49
The non-www version redirects to the old site instead of not at all, so I'm inclined to say it's a DNS problem, like Analog. – Ivo van der Veeken Jan 17 '14 at 13:29
I'm not convinced on the DNS but it could be cached locally. I'll leave my answer in place as it will do no harm for them to try and see if it does fix the problem. – zigojacko Jan 17 '14 at 14:00
True, even if it isn't a DNS-related problem, he should add these lines (or the inverse) to his htaccess. – Ivo van der Veeken Jan 17 '14 at 14:12

Remember that when doing the DNS you need to redirect the www (A) record and the root @ record to the new server.

Check that your domain name the non-www has propergated to the new server and IP, by using a tool like

If it has propagated it can also be your local browser / system that remembers, sometimes on windows you need to clear the local DNS cache as well.

share|improve this answer

This has to do with DNS, Domain Name Server. A DNS is a server which translates a domainname ( to an IP adress (, the IP adress of the server.

To you it seems normal that www and non-www are the same things, which isn't weird at all; about every site does this. However, this actually is a subdomain, like blog in the url

The most common (and recommended) trick to do this, is by using an alias (or: CNAME) to the actual A-record (which is the actual line). Small example to make it identical to the outside world: in A
www in CNAME

And now the explaining part:
You have a DNS cache. If you load, say, 10 images from a domain, and the browser has to look an IP up for every resource, then your speeds would drop, and the NameServer would buckle under the load. So they cache it, this is called a Time To Live (TTL), which is often something around 8 hours.

This process is done in your browsers, at your hosting, and at a more global level. They each have to update, which requires the step before to be updated. This can take up to 3 days.

  • If you control your webserver, you can speed this up via the commandline:
    service named restart
  • For your browser to empty their local cache, you can search for DNSflushers as addon
  • For your OS you can google how to do so, Windows has it's CMD where you can run:
    ipconfig /flushdns

Please note: Don't assume your users take this process. They'll have to wait.

Temp fix:
You can redirect the users to your www version, by placing this in the .htaccess of your old server:

RewriteCond %{HTTP_HOST} !^www
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=302,L]

This redirects everything to the www version, in this case your new server. Please note the 302 instead of a 301. The 302 is a temp-redirect, it can change further along the lines (which you should, pointing all visitors to the www version with a 301 redirect).

share|improve this answer

Your Answer


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.