website won't work without www. on 123-reg

7,784

For something like this, who your registrar is doesn't matter. Once you have registered the domain, then you also control all subdomains, including www.

Your DNS settings look correct. Based on your cname settings, your www sub-domain should resolve to the same IP address that your non-www domain resolves to. You can test this by pinging both and checking that the IP address matches:

$ ping website.co.uk
   64 bytes from myhost (192.168.55.55)
$ ping www.website.co.uk
   64 bytes from myhost (192.168.55.55)

Make sure the IP addresses given match (the 192.168.55.55 part in my example). If they don't you have a DNS problem.

Once DNS is set up correctly, you have to make sure the webserver is set up correctly. Again, it sounds like you are trying to do the correct thing and have a redirect in place. You say that you use a "302". I would suggest trying to use a "301 permanent redirect". You can test that it is correct by using the following command and seeing a response similar to the following:

$ curl -s -D - http://www.website.co.uk/
    HTTP/1.1 301 Moved Permanently
    Location: http://website.co.uk/
    Content-Type: text/html; charset=UTF-8

    <html><body><p>Moved permanently: <a href="http://website.co.uk/">http://website.co.uk/</a></p></body></html>
Share:
7,784

Related videos on Youtube

Simon Hayter
Author by

Simon Hayter

Updated on September 18, 2022

Comments

  • Simon Hayter
    Simon Hayter over 1 year

    I've got a website that works with my custom domain name with the www. but when I type it in without the www. it doesn't show up, and I've had customers wondering if my website is down because of this.

    I'd like my website to work with or without the www. whilst still showing the subdomains - eg: www.website.co.uk and www.website.co.uk/contact or website.co.uk and website.co.uk/contact but I can't get it to work without www.

    I'm not the most clued up person when it comes to DNS and servers and all that, so if you can give it to me in simple terms that would be great.

    I currently have my domain with 123-reg and my DNS forwarding is set up as follows:

    @ CNAME website.site.com
    www CNAME website.site.com
    

    I also have web forwarding set up as 302 - website.site.com but I think this gets overwritten by the CNAME stuff

    Please help me to resolve this as it is so frustrating - but please put it to me in simple terms as otherwise I won't understand!

    Thanks so much in advance everyone!!