1

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

Therefore:

Thanks

1
  • I wonder why would you want such thing, can you share? Maybe there is another solution, beside this.
    – mkudlacek
    Jun 16, 2010 at 10:05

4 Answers 4

4

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.

5

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.

2

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

0

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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .