How can I add www to my URL?
I followed the instructions for setting a host name here, but whenever I browse for http://www.foo.com, I get redirected to http://foo.com.
How do constantly keep www.foo.com?
I have the following DNS records:
| Type | Hostname | Value | TTL (seconds) |
|---|---|---|---|
| CNAME | *.foo.com | is an alias of www.foo.com. | 43200 |
| A | foo.com | directs to 201.227.660.894 | 3600 |
| A | www.foo.com | directs to 201.227.660.894 | 3600 |
| NS | foo.com | directs to ns1.digitalocean.com. | 1800 |
| NS | foo.com | directs to ns2.digitalocean.com. | 1800 |
| NS | foo.com | directs to ns3.digitalocean.com. | 1800 |
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
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
C:\Users\Alexei>python
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('http://amdb.com.br')
>>> print r.history
[<Response [301]>]
>>> print r.history[0].headers
{'Content-Length': '178', 'Server': 'nginx', 'Connection': 'keep-alive', 'Location': 'https://www.amdb.com.br/', '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 @)
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.