400 error hostname invalid

Hi

We moved a website to another dedicated host and found that the http://examplesite.com URL gives us a 400 error but the putting www in front makes it work

so I placed the following code in the .HTAccess file and this has no effect

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

is something messed up with the DNS?

any ideas

Many thanks

aa,

Yes, it’s your DNS. Check the A record as it needs to have both the www and non-www versions there TO RECEIVE THE REQUESTS. .htaccess if of no use if it doesn’t receive the request, is it?

If this is your localhost (test server), then you have the VirtualHost setup for only one version and, probably, nothing in your hosts file. Do go update both of those.

Regards,

DK

Thank you for your great knowledge, worked a treat. Perfect!