[Linux-disciples] apache question

Adam Rosi-Kessel adam at rosi-kessel.org
Wed Mar 3 20:20:49 EST 2010


Adam Rosi-Kessel wrote, on 3/3/2010 7:01 PM:
>> myapp.domain.com/folder points to www.domain.com/folder
>> How would you do this in Apache?
> I guess I'm still puzzled at your starting conditions. If you control
> the web server, you can just have the domain names map to the same place
> on the filesystem.
> ServerName myapp.domain.com
> ServerAlias www.domain.com
> DocumentRoot /home/user/public_html/myapp.domain.com
> Would result in myapp.domain.com/folder giving the same content as
> www.domain.com/folder, without any visible rewriting of the URL.

To answer your original question, you would do this with mod_proxy in 
reverse proxy mode. Something like this:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /folder http://www.domain.com/folder
ProxyPassReverse /folder http://www.domain.com/folder

There might also be a RewriteRule [P] way to do this.

But the reason I say you're likely asking the wrong question is you are 
trying to do something that is very rarely done, or at least trying to 
accomplish it in a way that is very rarely done. Whenever you are trying 
to do something weird like this on the web, you need to be suspicious 
that you're barking up the wrong tree.


More information about the Linux-disciples mailing list