![]() |
Apache mod_rewrite RewriteCond infinite loop problem
Hi,
short description of situation: I have a reverse proxy built from Apache 2.2.3 with load balancing using mod_balancer. For security reasons I need to redirect all locations different from /balancer (Load Balancer web interface) to server root (/). I made a following piece of code which should do the job but it creates an infnite loop instead: RewriteEngine On RewriteCond %{REQUEST_URI} !^/balancer$ RewriteRule ^/(.*)$ / [R,L] When I remove the exclamation from the second line, it works, but does exactly opposite of desired - rewrites only requests for /balancer, everything else is untouched. I suppose misconfiguration somewhere in negation of second line but I can't find it... Someone any idea? Thanks for help! jika |
If the request is not /balancer then it gets rewritten to /, which is also not balancer, so it gets rewritten again to / and so on. Throw in another couple rules:
Code:
RewriteEngine On |
zaichik, thanks for help. However it is not working exactly as expected - all requests are rewritten to / - it is impossible to reach /balancer. This is caused by the first line of your code - all requests match it.
Finally I made it a little different way, which is not 100% I wanted at the beginning, but it is satisfactory enough for me: Code:
RewriteEngine On |
| All times are GMT -5. The time now is 12:04 AM. |