httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <>
Subject Re: [users@httpd] mod_rewrite, proxys, authorization and redirects
Date Thu, 21 Jun 2007 13:31:49 GMT
On 6/21/07, Martijn <> wrote:
> Hello.
> My webserver uses a second server (non-apache) to deliver certain
> content, say xml files. This server runs on the same machine, on a
> different port. In my httpd.conf I have the following line
>   RewriteRule ^(.*\.xml)$ http://localhost:8000/$1 [P]
> which, indeed, successfully lets the second server take care of the
> delivery of xml files.
> Now from what I understand from the mod_perl documentation, the
> rewriting of URLs takes place before any authentication/authorization.
> However, if I block access to certain URLs -either via a mod_perl
> module or via 'Deny from all'- access is denied and the second server
> is never reached. This is in fact what I want, but I'd like to
> understand why this is happening, as I think it's contradicting the
> documentation. Does anyone have any clues?

I don't know much about mod_perl, but this depends on a couple factors:

1. If you are using .htaccess files rather than httpd.conf for
applying RewriteRules, then you are more likely to get per-directory
configuration applied, including auth.

2. There are multiple ways to apply configuration to particular parts
of the server. <Directory> applies to particular filesystem
directories, and therefore normally wouldn't be applied to proxied
requests that never hit the filesystem. <Location> applies to URLs and
therefore should apply to all requests whether or not they map to the
local filesystem.

> Furthermore, I have a few simple questions about Redirect and RedirectMatch:
> - is it true that RedirectMatch is exactly the same as RewriteRule
> with the [R] flag?

In effect, yes. But of course RewriteRule is much more flexible.

> - if I use [R] flags, are the rules still applied top-down?

If you mean sequentially, then yes.

> - is there any need for [L,R] flag? I would think that R forces the
> whole mod_rewrite-process to start again, with a new URL so it could
> not be anything but the last rule that is applied.

In fact, if I remember correctly, rewriting will continue after an R
flag. This means that subsequent RewriteRules may, for example, change
the target URL before the actual rewrite happens. (But I haven't tried
this myself in a while, so I may be remembering incorrectly.)


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message