Mobile app version of vmapp.org
Login or Join
Lengel546

: Www & no-www issue after server migration 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

@Lengel546

Posted in: #Domains #NoWww #Server

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 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 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.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel546

3 Comments

Sorted by latest first Latest Oldest Best

 

@Deb1703797

This has to do with DNS, Domain Name Server. A DNS is a server which translates a domainname (example.com) to an IP adress (123.45.6.78), 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 blog.example.com.

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:

example.com. in A 123.45.6.78
www in CNAME jewelsite.nl


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 ^(.*)$ www.%{HTTP_HOST}/ [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).

10% popularity Vote Up Vote Down


 

@Bryan171

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 www.whatsmydns.net/
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.
www.tech-recipes.com/rx/233/clear_windows_dns_cache/

10% popularity Vote Up Vote Down


 

@Jessie594

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 ^(.*)$ www.%{HTTP_HOST}/ [R=301,L]


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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme