• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[L] flag dose not work at the RewriteRule


I have such code in to the .htaccess file:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} /one1
RewriteRule ^[^.]*$ for_one.php [L]

RewriteCond %{REQUEST_URI} /two2
RewriteRule .* for_two.php [L]

Here every thing works as it should be:

test.ru/one1 => for_one.php
test.ru/two2 => for_two.php

But when I exclude second RewriteCond every thing breakes:

I call /one1 it return me for_two.php

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} /one1
RewriteRule ^[^.]*$ for_one.php [L]

RewriteRule .* for_two.php [L]

test.ru/one1 => for_two.php

Nevertheless it must work: first RewriteCond is true and there is [L] flag after RewriteRule, so the Rewriting process must stop!

Why [L] flag dose not work?
Why the rewriting process dose not stop?

Here is text from apache manual:

Stop the rewriting process here and don't apply any more rewrite rules. This corresponds to the Perl last command or the break command in C. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. 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 here Internal-Redirection happened? but what is this, and how it could happend? I did not call Redirect flag [R].

Or internal Redirection is alway when using .htacess files?....

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.