apache - mod_rewrite rule matched, but chain is not left -


please me find solution behavior strange me.

here htaccess

<ifmodule mod_rewrite.c> rewriteengine on rewriterule     ^emltr\.gif$                   aaa.html [l]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$                            index.php [l,qsa] </ifmodule> 

note l flag, when "gif" rule matched chain left. not.

the requested url "emltr.gif"

if "catch-all" rule , conditions commented, "gif" rule correctly taken. ("aaa.html" not exists, test prevent unwanted circular behavior.)

if "catch-all" rule uncommented, taken, rather first rule. why second 1 taken rather first? or else: why isn't chain left though l flag, , second rule evaluated?

thank you

this documented in manual l|last

the [l] flag causes mod_rewrite stop processing rule set. in contexts, means if rule matches, no further rules processed.

if using rewriterule in either .htaccess files or in <directory> sections, ... simplified form of once rules have been processed, rewritten request handed url parsing engine may it. possible rewritten request handled, .htaccess file or section may encountered again, , ruleset may run again start. commonly happen if 1 of rules causes redirect - either internal or external - causing request process start over.

an alternative flag, [end], can used terminate not current round of rewrite processing prevent subsequent rewrite processing occurring in per-directory (htaccess) context. not apply new requests resulting external redirects.

in short, when have rewrite rules in .htaccess file or inside directory directive, request processed again, if rewritten round. when there no more rewrite, stop.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -