Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:
the other:

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.


share|improve this question

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/(.*)$$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
share|improve this answer

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:


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.

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.