httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eimantas Vaiciunas <eimantas.vaiciu...@sc.vu.lt>
Subject Re: [users@httpd] Problems configuring dynamic mod_rewrite rules with proxy
Date Wed, 04 Aug 2004 05:47:14 GMT
On Tuesday 03 August 2004 23:02, Ed Stafford wrote:
> RewriteCond %{HTTP_REFERER} /foo1/
>         RewriteRule ^/foo1/(.*) http://192.168.0.1/$1 [P,L]
> RewriteCond %{HTTP_REFERER} /foo1/
>         RewriteRule ^/(.*) http://192.168.0.1/$1 [P,L]
> RewriteCond %{HTTP_REFERER} /foo2/
>         RewriteRule ^/foo2/(.*) http://192.168.0.2/$1 [P,L]
> RewriteCond %{HTTP_REFERER} /foo2/
>         RewriteRule ^/(.*) http://192.168.0.2/$1 [P,L]
>
> Another thing that concerns me is I don't think I should have to have
> the RewriteCond repeated, however, if I don't, then the second rule
> doesn't seem to work.  It may be a case of still not comprehending how
> RewriteCond is parsed or used, so I'm hoping someone here can
> enlighten me.
Well you shouldn't use the [L] flag after first rewriteRule since it means 
that this is tha LAST RewriteRule and that's why you have to use another 
RewriteCond. Here how it should look:

RewriteCond %{HTTP_REFERER} /foo1/
        RewriteRule ^/foo1/(.*) http://192.168.0.1/$1 [P]
        RewriteRule ^/(.*) http://192.168.0.1/$1 [P,L]
# We leave the L flag here (^^^^^^^^) since we're matching another pattern
RewriteCond %{HTTP_REFERER} /foo2/
        RewriteRule ^/foo2/(.*) http://192.168.0.2/$1 [P]
        RewriteRule ^/(.*) http://192.168.0.2/$1 [P,L]
# And here we stop rewriting.


-----
Eimis


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message