Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

Therefore:

  • 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

Thanks

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
add comment

4 Answers 4

up vote 4 down vote accepted

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

example.org.   86400   IN      A       127.0.0.1  
*.example.org. 86400   IN      A       127.0.0.1  
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        127.0.0.1 ;; 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 (127.0.0.1). 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
add comment

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.

share|improve this answer
add comment

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
add comment

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!

share|improve this answer
add comment

Your Answer

 
discard

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.