A problem every web developer has when starting with a new project is
This is called the "canonical URL" and it's fairly important that you choose one option and stick to it. If you choose to use the
www subdomain, all traffic to the non-www URL should forward to it and keep the path intact, e.g. domain.com/blog/article.html should foward to www.domain.com/blog/article.html
Which option to choose is up to you, there is no right or wrong answer, although many people argue that the
www subdomain is not necessary nowadays since it comes from a time where
telnet were other equally-important subdomains. Many short domains opt to use the non-www version, presumably to make their domain appear even shorter, and it also seems common for
If you choose to use the
www subdomain, you need to find a way to forward all trafic from the non-www domain. Some domain registrars (like Namecheap [referral link]) or DNS management services (like DNSMadeEasy [referral link]) offer a forwarding option but many do not.
WWWizer - free naked domain redirect
A great service to solve this problem which I have been using for years is WWWizer. Their core offer is "SSL for the Cloud." but they let you forward your non-www domain for free.
The way it works is that you simply point your naked domain to a specific IP (220.127.116.11) and all traffic will be forwarded to the
www subdomain to that domain.
Set up your www prefix to serve your content (mine is a CNAME for a static website on Amazon S3)
Set up an A Record for your naked (non-www) domain pointing to 18.104.22.168
That's it! Your naked domain should now forward to your www-domain!