Re: mod_rewrite, L and F flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 1, 2008 at 8:01 AM, Stephen Wellington
<wellingtonsteve@xxxxxxxxx> wrote:
> Hi,
>
> Am having trouble with mod_rewrite and would appreciate a little help.
> I've tried searching Google and reading the manual but found little
> that helps!
>
> I am trying to achieve something like this:
>
> RewriteRule ^a.php$ b.php [L]
> RewriteRule ^b.php$ - [F]
>
> The intention is that requests to a.php will serve the contents of
> b.php, but if a user tries to go directly to b.php they are given a
> 403 error.  My understanding is that L flag stops further matching of
> rules. but this doesn't appear to work, neither does a 'solution' from
> Google of using the NS flag in the second rule.

Your strings don't start with a slash, which means you're in
directory/location/htaccess context.

In this context, after any rewrite occurs the entire process is
re-started with the new URL.  This makes 'L' work a little different
then in virtualhost context.

"Remember, however, that if the RewriteRule generates an internal
redirect (which frequently occurs when rewriting in a per-directory
context), this will reinject the request and will cause processing to
be repeated starting from the first RewriteRule."

Maybe you could set an environment variables [E=foo:bar] to remember
you've rewritten this request?

-- 
Eric Covener
covener@xxxxxxxxx

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux