Take the 2-minute tour ×
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 www.example.co.uk is working but just typing mydomain.co.uk 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
2  
Are you sure this is not just a DNS propagation issue ? Possible Cache on your computer. –  Analog Jan 17 at 10:14
    
It sounds like the A record for the non-www (mydomain.co.uk) 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 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 at 18:44

1 Answer 1

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 at 11:10
2  
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 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 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 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 at 14:12

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.