How in DNS can i redirect all A and MX records from example.us to example.org?


  • Users who go to www.example.us will be forwarded to www.example.org
  • An email to webmaster@example.us will be forwarded to webmaster@example.org


  • 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

In the DNS for example.org you would have something like this:

example.org.   86400   IN      A  
*.example.org. 86400   IN      A  
example.org.   86400   IN      MX      mail.example.org  

In the DNS for example.us you could either mirror the above or use a CNAME like this:

example.us.   86400   IN      a ;; shoudln't use CNAME here 
*.example.us. 86400   IN      CNAME    example.org
example.us.   86400   IN      MX       mail.example.org

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 ^/(.*)$ http://example.org/$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 (example.org) 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.


If you own both example.us and example.org, 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.


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


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

MX 10 example.us CNAME mail.example.org.

www.example.us CNAME www.example.org.

Don't forget the final dot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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