LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How do I get Apache Rewrite to proxy two domains ? (https://www.linuxquestions.org/questions/linux-server-73/how-do-i-get-apache-rewrite-to-proxy-two-domains-686132/)

anon252 11-25-2008 08:08 PM

How do I get Apache Rewrite to proxy two domains ?
 
I am trying to set up an Apache conf file that will allow me to reverse proxy two (or more) different domains. Here's what I have:

In my example below, I am trying to proxy inbound requests as follows:
requests for www.abc.com are proxied to www.abcdest.com
requests for www.def.com are proxied to www.defdest.com

<VirtualHost *>
ServerName www.abc.com
RewriteEngine on
RewriteRule ^(.*) http://www.abcdest.com$1 [P]
</VirtualHost>

<VirtualHost *>
ServerName www.def.com
RewriteEngine on
RewriteRule ^(.*) http://www.defdest.com$1 [P]
</VirtualHost>

www.abc.com correctly proxies www.abcdest.com.
However, when I go to www.def.com, I get www.abcdest.com!

I've been trying to figure this out for a couple of days...

Any help would be greatly appreciated.

Thanks,

Russell

datopdog 11-28-2008 05:16 AM

Why dont u use mod_proxy instead it was designed for what u want to do
Code:

<VirtualHost *>
ServerName www.def.com
ProxyPass        /  http://www.defdest.com/
ProxyPassReverse  /  http://www.defdest.com/
</VirtualHost>



All times are GMT -5. The time now is 04:17 PM.