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

DNS / apache rookie here..

I've searched for the answer and no luck but it's possible that I don't know what to look for in a solution.

Many subdomains under .domain2.com each redirect to a specific page:


I would rather avoid making any changes to domain2.com (in order to be backwards compatible). I would like to make things easier for users and create an alias from domain1.com to the page on domain2.com


I can do anything necessary to the config situation with domain1.com

If you don't mind, let me know if this is a poorly described/incomplete question.


share|improve this question

2 Answers 2

You can't do this with DNS. It would be nice... You'll have to look at doing redirects via the web server, either natively or using the mod_rewrite module to do URL rewrites.

share|improve this answer

If you wanted to just have an alias from domain1.com to domain2.com

you can make an .htaccess on the webroot of domain1.com

Options +FollowSymLinks
rewriteEngine on
rewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com
rewriteCond %{QUERY_STRING} .
rewriteRule (.*) http://www.domain2.com [R=301,L]

Of course your description a little confusing as to what should be backwards compatible (sounds like there will be two systems to go hand in hand) but hopefully little modification (including subdomain check and insertion) to this script will get you where you want to be.

You can put this on vhost.conf as well. Remember to execute a2enmod and AllowOverride All

Cheers, D

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.