On Mon, Sep 1, 2008 at 1:25 PM, Eric Covener <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 1, 2008 at 8:01 AM, Stephen Wellington
> <[EMAIL PROTECTED]> 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
> [EMAIL PROTECTED]
>

Thank you for your help; I have taken your advice on the environment
variables and used this:

RewriteRule ^a.php$ b.php [E=foo:bar]
RewriteCond %{ENV:foo} !="bar"
RewriteRule ^b.php$ - [F]

However requests to a.php are still returning a 403. Could you tell me
if I'm missing the point with the way these variables work?

Thank you

---------------------------------------------------------------------
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: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to