Forum Moderators: phranque
I have an Apache who receives the http requests and a IIS in another box with IP 192.168.0.250.
I'll like to rewrite the request and then send it to the IIS.
To do so I wrote in the httpd.conf :
<VirtualHost *:80>
ServerName www.test.com
ServerAlias test.com *.test.com
RewriteEngine On
RewriteRule ^/shoes/([A-Za-z0-9-]+)/$ /web/default.asp?shoe=$1 [L]
ProxyPass / [192.168.0.250...]
ProxyPassReverse / [192.168.0.250...]
ProxyPreserveHost On
ErrorLog logs/test_error.log
CustomLog logs/test_access.log common
</VirtualHost>
But it doesn't works, with only the proxy rules everything goes OK but with the rewrite rule nothing works.
żAny suggestion?
Thanks.
RewriteRule ^/shoes/([A-Za-z0-9-]+)/$ http://192.168.0.250/web/default.asp?shoes=$1 [P]
Jim
I have several web pages served by the back-end server with IIS, all of them are proxyed by the Apache (who serves other web pages in PHP) . In the webs served by the IIS I don't need to rewrite the URL. So, with:
<VirtualHost *:80>
ServerName www.epegatina.com
ServerAlias epegatina.com *.epegatina.com
ProxyPass / [192.168.0.250...]
ProxyPassReverse / [192.168.0.250...]
ProxyPreserveHost On
ErrorLog logs/epegatina_error.log
CustomLog logs/epegatina_access.log common
</VirtualHost>
works fine.
But now I'll like to do friendly URL's. With the web pages served by the Apache it's easy but the ones served by the IIS I'll like to do the rewrite on the Apache before the proxying.
With:
RewriteRule ^/shoes/([A-Za-z0-9-]+)/$ [192.168.0.250...] [P]
I'm not telling to the IIS witch URL to serve. Essential, I thing.
But when I tried to do your proposal (deleting the proxy lines leaving only the rewrite ones) I received the listing of the DocumentRoot of the Apache.
So, I'm confused.
I'm sure that I'm not the one who tries to do somethink like this. But I'm not able to find the correct way or an example.
Thanks Jim.
That's why I said your ProxyPass and ProxyPassReverse set-up didn't look quite right.
If your front-end is Apache 2.x with PCRE support, consider using ProxyPassMatch and Perl-Compatible Regular Expressions to exclude the "/shoes" path from being directly proxied to the back-end (using a negative-pattern match).
Jim