You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lesley Kimmel <lj...@hotmail.com> on 2014/10/03 19:31:59 UTC
[users@httpd] Odd? mod_rewrite behavior
All;
I have an application being proxied through Apache which is also serving some static content for the web application. The application is '/xyz(.*)' and the static content is '/xyz-static-content'. The requests for the static content come in as '/xyz_<version>' and have to be rewritten to '/xyz-static-content'.
I can successfully get both to work with the following rules:
RewriteRule ^xyz-static-content_[A-Z0-9a-z._-]+/(.*) xyz-static-content/$1
RewriteRule ^xyz/?$ xyz/ [C]
RewriteRule ^xyz/(.*) http://appserver:port/xzy/$1 [P]
However, the following set of rules does not work (the static content does not display):
RewriteRule ^xyz-static-content_[A-Z0-9a-z._-]+/(.*) xyz-static-content/$1 [L]
RewriteRule ^xzy(.*) http://appserver:port/xyz$1 [P]
It seems that even the 'xyz-static-content' requests are falling through to, and matching, the proxy statement despite the 'L|Last' flag. Can anyone explain this behavior? I'm trying to use the second set of rules to avoid having to rewrite the situation where the user requests just '/xyz' to '/xyz/'.
Thanks,
-Kimmel
RE: [users@httpd] Odd? mod_rewrite behavior
Posted by Lesley Kimmel <lj...@hotmail.com>.
Thanks for that lead. These rules ARE in a 'Directory' block so this is the case. It looks like I can resolve this by placing a 'catch-all' after the first 'xyz-static-content' rewrite:
RewriteRule ^xyz-static-content_[A-Z0-9a-z._-]+/(.*)$ xyz-static-content/$1
RewriteRule ^xyz-static-content - [L]
Do you see any more straight-forward or efficient way to handle this?
Thanks,
-Kimmel
Date: Fri, 3 Oct 2014 13:35:03 -0400
From: covener@gmail.com
To: users@httpd.apache.org
Subject: Re: [users@httpd] Odd? mod_rewrite behavior
On Fri, Oct 3, 2014 at 1:31 PM, Lesley Kimmel <lj...@hotmail.com> wrote:
It seems that even the 'xyz-static-content' requests are falling through to, and matching, the proxy statement despite the 'L|Last' flag. Can anyone explain this behavior? I'm trying to use the second set of rules to avoid having to rewrite the situation where the user requests just '/xyz' to '/xyz/'.
The manual has cautions about the L flag and per-directory (htaccess) rewrites. When you make a substitution in htaccess, the whole thing starts over.
Re: [users@httpd] Odd? mod_rewrite behavior
Posted by Eric Covener <co...@gmail.com>.
On Fri, Oct 3, 2014 at 1:31 PM, Lesley Kimmel <lj...@hotmail.com>
wrote:
> It seems that even the 'xyz-static-content' requests are falling through
> to, and matching, the proxy statement despite the 'L|Last' flag. Can anyone
> explain this behavior? I'm trying to use the second set of rules to avoid
> having to rewrite the situation where the user requests just '/xyz' to
> '/xyz/'.
The manual has cautions about the L flag and per-directory (htaccess)
rewrites. When you make a substitution in htaccess, the whole thing starts
over.