Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just registered a domain name (say ). I also have a website with content on it (say

I would like to redirect visitors that type to Can this be done with DNS records (and if so , how?)?




Thanks for all the answers! I understand that it works only for top level domains. What about subdomains? Can I use CNAME to redirect to ?

share|improve this question

migrated from Sep 21 '10 at 16:43

This question came from our site for professional and enthusiast programmers.


No, this can't be done with DNS records.

CNAME records can only redirect hostname to hostname, not hostname to full URL.

To do what you require you need a separate web server on which issues an HTTP redirect to send the user to the right URL. Note that your cheap web-host address will then also appear in the user's browser address bar.

Alternatively, if your web content is also available as then a CNAME to that is legal.

However the webserver will need to be configured to accept your new domain name (i.e. via the Host: header) and know which user's content to serve. Your free webhost may not permit that.

share|improve this answer

Yes, subdomains are handled by DNS so you can set up a CNAME to point at (it's best not to call it a "redirect" - that's handled at the HTTP level, so it's potentially confusing).

Note though, that this still might not work correctly. It's probably best to set up a record in your drivers/etc/hosts file first and test that it works before you go about changing DNS records.

share|improve this answer

Two steps:

  1. You'll need to create a CNAME from to
  2. Create a redirect page (php, aspx, etc) at to send anyone who hits it to

You cannot fully implement your solution with DNS alone, but with the above steps you can achieve the result you are looking for.

share|improve this answer
It should probably be assumed that the OP cannot install content or redirections at the freehost's web root. – Alnitak Sep 21 '10 at 15:07
Can I use CNAME to redirect to, i.e. subdomain – Joel Sep 21 '10 at 15:15
yes, that's legal. However the webserver will need to be configured to accept your new domain name (i.e. via the Host: header). Your free webhost may not permit that. – Alnitak Sep 21 '10 at 15:20

You really should be doing this via the htaccess file, not DNS. There are specific reasons you modify your CNAME records, a simple redirect is not one of them. Look here for a tutorial on htaccess, or google for one on your own.

EDIT: Also note that your web hosting provider will likely have an option in their control panel to do this for you if both domains have their DNS pointed to them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.