Add www to my url

October 14, 2017 819 views
DNS Networking Ubuntu 16.04

How can I add www to my URL?

I followed the instructions for setting a host name here, but whenever I browse for, I get redirected to

How do constantly keep

I have the following DNS records:

Type Hostname Value TTL (seconds)
CNAME * is an alias of 43200
A directs to 201.227.660.894 3600
A directs to 201.227.660.894 3600
NS directs to 1800
NS directs to 1800
NS directs to 1800
3 Answers

You'll have to verify who's redirecting your domain. Is there any app running there?

If you use python (and requests library) try this

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> r = requests.get('')
>>> print r.history
[<Response [301]>]
>>> print r.history[0].headers
{'Content-Length': '178', 'Server': 'nginx', 'Connection': 'keep-alive', 'Location': '', 'Date': 'Wed, 18 Oct 2017 11:13:34 GMT', 'Content-Type': 'text/html'}

Inspecting all history entries' headers, you'll get some hint about who's redirecting. In this example, nginx itself. I believe your problem isn't in the DNS, because it doesn't make redirections. Servers and applications do.

Delete 1st and 3rd entries and add a CNAME value www to server @ (yes, just @)

  • I did as advised and waited more than the required TTL. It didn't have effect.
    All what is left is:

    Type Hostname Value
    CNMAE is an alias of
    A directs to 201.227.660.894
    NS directs to
    NS directs to
    NS directs to

    still get redirected to when I type :\

Have another answer? Share your knowledge.