Question

How can I redirect www.mysite.com to mysite.com using DigitalOcean DNS?

  • Posted December 18, 2012

I’ve tried to use cname, A record, and I didn’t get it to work.

Subscribe
Share
CNAME      www         @
A           @        IPADDRESS
CNAME      www         @
A           @        IPADDRESS
CNAME      www         @
A           @        IPADDRESS
CNAME      www         @
A           @        IPADDRESS
CNAME      www         @
A           @        IPADDRESS
CNAME      www         @
A           @        IPADDRESS

I’ve tried all of the suggestions and it doesn’t work. I’m using Cloudflare.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Create CNAME record: <br>www <br>mysite.com.

Create CNAME record: <br>www <br>mysite.com.

We’ve done this redirect multiple times and it’s always been through a redirect on the web service layer whether that’s in Apache or Nginx. <br> <br>In Nginx you can do this very simply: <br>server { <br> listen 80; <br> server_name mysite.com; <br> return 301 https://www.mysite.com$request_uri; <br> } <br> <br>If you are using Apache let us know.

Sorry to re-open this thread…

I need to redirect: mail.mydomain.com to other URL google.com/mail

I’m using Ngix, how can I do this? May I do this in DNS or in nginx config?

Cheers.

@david: Apache config changes take effect instantly after restarting Apache (assuming your DNS records are proper). You need to add a VirtualHost as follows: <br><pre><VirtualHost *:80> <br> ServerName www.example.com <br> Redirect permanent / http://example.com/ <br></VirtualHost></pre> <br>Ubuntu 12.04: <a href=“https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts”>https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts</a>. <br><br>Ubuntu 14.04: <a href=“https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts”>https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts</a>.

About how long does it take for this to propagate? I still only see the default apache page at www.mysite.com whereas mysite.com has been fine. Do I need to restart the server?

nightflash is correct. ‘www’ pointing to ‘mysite.com.’ is the right way to do it in Digital Ocean’s DNS settings. Don’t forget the ‘.’ at the end of your domain.