You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by cincin104 <ka...@hp.com> on 2003/03/05 23:35:24 UTC

RewriteRule - misdirects for different virtual hosts .. pls help

Hi All,

I have 3 virtual hosts for my web server

1 - VIP of the load balancer (a.a.a.com)
2 - external IP (public internet) for the server (b.b.b.com)
3- Internal IP accesible only by private intranet (c.c.c.com)

I have a Rewrite rule defined as follows for each VirtualHost entry 
as shown below:

<VirtualHost 11.11.11.11>
DocumentRoot "/var/wwroot/support"
ServerName a.a.a.com
ErrorLog /opt/apache/logs/error_log
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/software/analysis/(.*) https://a.a.a.com/ 
software/analysis/$1 [L,R]
RewriteLog /opt/apache/logs/rewrite_log
</VirtualHost>

<VirtualHost 22.22.22.22>
DocumentRoot "/var/wwroot/support"
ServerName b.b.b.com
ErrorLog /opt/apache/logs/error_log
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/software/analysis/(.*) https://b.b.b.com/ 
software/analysis/$1 [L,R]
RewriteLog /opt/apache/logs/rewrite_log
</VirtualHost>

<VirtualHost 33.33.33.33>
DocumentRoot "/var/wwroot/support"
ServerName c.c.c.com
ErrorLog /opt/apache/logs/error_log
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/software/analysis/(.*) https://c.c.c.com/ 
software/analysis/$1 [L,R]
RewriteLog /opt/apache/logs/rewrite_log
</VirtualHost>

I also have the ServerName parameter in httpd.conf defined as:
ServerName a.a.a.com

Here is my problem:
When I hit the URL for http://a.a.a.com/software/analysis/x.jsp it 
gets redirected fine to https://a.a.a.com/software/analysis/x.jsp 

But for the other two URLs, http://b.b.b.com and http://c.c.c.com 
takes me again to https://a.a.a.com/software/analysis/x.jsp as 
opposed to their respective URLs 
https://b.b.b.com/software/analysis/x.jsp and 
https://c.c.c.com/software/analysis/x.jsp 

I am confused as to why the redirection is not happening fine for the 
remaining 2 virtual hosts. Am i doing anything wrong here?

Any help is greatly appreciated. Thanks in advance.

Kalyan


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org