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

How in DNS can i redirect all A and MX records from to


  • Users who go to will be forwarded to
  • An email to will be forwarded to


share|improve this question
I wonder why would you want such thing, can you share? Maybe there is another solution, beside this. – mkudlacek Jun 16 '10 at 10:05
up vote 4 down vote accepted

In the DNS for you would have something like this:   86400   IN      A  
* 86400   IN      A   86400   IN      MX  

In the DNS for you could either mirror the above or use a CNAME like this:   86400   IN      a ;; shoudln't use CNAME here 
* 86400   IN      CNAME   86400   IN      MX

You would then have to tell your web and mail servers to handle the second domain.
In Apache I would do something like this:

#force url's to cannoical Domain name (ie. Remove wwww)
RewriteCond %{HTTP_HOST} !^example\.org$ [NC]  
RewriteRule ^/(.*)$$1 [R=301,L]

For your email server you would set an alias or depending on what mail server your using there's probably a configuration directive to have it do the aliasing for multiple domains automatically.

Just for clarification you can't really "redirect" solely using DNS. DNS only translates between the domain name ( and the IP Address ( You can use DNS to tell the client to look at another domain for the final resolution of the IP Address (ie. use a CNAME), but the services running on that sever need to know how to handle the multiple domains. That said, many services only care about the IP Address and so will handle the extra domain without any addtional configuration, but often for http and email you will want to tweak how each domain is handled.

share|improve this answer

If you own both and, just set the DNS records on both domains to point to the same servers. On the web server, add a virtual host or rewrite rule to trap requests for .us and 301 redirect them to the .org name. On the mail server, add the .us domain as an alias for the .org domain and people will be able to use either to get mail to your mailboxes.

share|improve this answer

It's not clear why you'd want to do that, but you're probably approaching your problem at the wrong level.

share|improve this answer

There is no "jolly" DNS record to forward all subdomains. You should change every record to point to a relative CNAME on


Don't forget the final dot!

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.