1

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:

(subdomain1.domain2.com/folder/folder/?query=string).

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

subdomain1.domain2.com/folder/folder/?query=string

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.

Dan

user20013
  • 11
  • 1

2 Answers2

3

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.

squillman
  • 37,883
  • 12
  • 92
  • 146
2

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

Devrim
  • 1,187
  • 4
  • 16
  • 29