Report this

What is the reason for this report?

How do I set my domain to forward to a subdomain?

Posted on June 29, 2016

Please view my current DNS set up: link to set-up

I want to have subdomain: blog.mydomain.com and I want all requests to mydomain.com to be forwarded to blog.mydomain.com.

The result being whether you provided the blog subdomain or not you are taken to the blog.subdomain.com so the user knows that they are viewing the blog.

I have tried creating an A record and a CNAME record. Neither work.

For a CNAME if I set the name “@” and the hostname “blog.” I get the error: cname records cannot share a name with other records.

Do I need a differently configured CNAME record or an A record?

Thanks, Tom



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!

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.

Did you just want to redirect all http traffic to blog.yourdomain.com? One method to do this is to create a catch-all DNS entry and then create a virtual host (or server block) with your webserver. For DNS

CNAME    *   yourdomain.com.

Note the period at the end above when entering the record in the DO control panel.

Search the tutorials to match your distribution and webserver; search for the string “virtual host”. In your case, set the default virtual host or server block to handle blog.yourdomain.com.

If you want requests for other domains to be redirected to blog.mydomain.com (i.e. the user always sees ‘blog.mydomain.com’ in their url bar), then you need to set up a 301 redirect. This is accomplished via your web server. Let me know what server you are using, and I’ll show you how.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.