I'm sure someone has asked the same question on serverfault but I just don't know what to look for.

I have two subdomains from different hosts in my school. eg.

One is:     tr33house.domain1.school.edu
the other:  tr33house.domain2.school.edu

Domain one doesn;t support python sites so I have to put the site in domain two and need forward all users to domain two but I want some kind of url masking so I users can see domain one's name at the url when they are redirected to domain two.

I have access to both machines' .htaccess files.



If mod_proxy is turned on for the domain1 server, you can use the P flag along with mod_rewrite:

RewriteRule ^path/that/uses/python/(.*)$ http://tr33house.domain2.school.edu/path/that/has/python/$1 [L,P]

If there are things like redirects, and/or cookies that need their locations, paths, or domains rewritten, you can use mod_proxy's reverse directives:

ProxyPassReverse /path/that/uses/python http://tr33house.domain2.school.edu/path/that/has/python

Would it be possible to point the DNS entry also to this new location?

If so, you could do that and then add one line to your vhost.conf on the host where domain one is located:

ServerAlias tr33house.domain1.school.edu

Apache can handle different domain names in one vhost. The url the user sees then, is the url he reached the site with.

Be aware. Google doesn't like to find the exact same content under two different URL's.

Rewriting will definitely be more expensive than that.

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.