Question about setting up both www and non-www domain names

February 19, 2015 1.2k views

I had a droplet set up running off an IP address and I needed to add a domain to it.

I added say '' using the domain control panel.

My client also wanted '' to work and I was in a hurry, so I simply added that domain as well.

Now both work fine (there aren't any redirections).

Reading back over the DNS documentation however, I see that I apparently shouldn't have done it that way. The correct procedure is to have added the bare domain and then added the www version as an alias?

What are the advantages to doing it that way? What's wrong with what I did? Have I set myself up for problems in the future?

1 comment
  • Adding www as an A-record and then adding as an alias is a good way to go. Then you should decide which one the website should resolve to.

    Once you have that, you can add something to your .htaccess to resolve www to the main domain. So when someone types in they will end up at

    or vice versa.

    From what I understand, choosing one over the other is preferable, as some website applications (such as WordPress) do not play well with multiple versions of a domain.
    Also, I seem to remember Google not liking a website to have two domains, as it shows up as duplicate content...but do not quote me on that one.

2 Answers

www is often added as a CNAME but it will work as A also.

If you don't setup redirections to non-www to www. OR www. to non-www. So in that case there is possibility that search engine indexed both non-www. and www. URL and it's create big mashup.

Read below article by matt cutts

SEO advice: url canonicalization

I hope this will help you

For Nignx:

#run this command#
sudo nano /etc/nginx/site-available/

#copy and paste below content#
server {
         listen 80;
         server_name 123.456.789.10    ;
         return 301$request_uri;

Using this you can redirect your to

Have another answer? Share your knowledge.