Forum Moderators: phranque

Message Too Old, No Replies

What does this mean?

         

th1chsn

4:14 am on Jan 31, 2009 (gmt 0)

10+ Year Member



I'm new to htaccess. Can someone help me figure out what this means?

RewriteRule ^(public_html/somedirectory) - [L]

jdMorgan

2:39 pm on Jan 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It means, "If the requested URL-path starts with '/public_html/somedirectory', then leave that URL-path unchanged, and stop mod_rewrite processing for this pass through .htaccess."

Such a rule is usually used before all other rules which are to be skipped if the requested URL matches this rule's pattern. It basically means, "If we get a request matching this URL-path, quit processing mod_rewrite directives and don't even evaluate the remaining rules in this .htaccess file."

Jim

th1chsn

5:30 pm on Jan 31, 2009 (gmt 0)

10+ Year Member



Thanks for clearing that up for me.

wilderness

6:15 pm on Jan 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It basically means, "If we get a request matching this URL-path, quit processing mod_rewrite directives and don't even evaluate the remaining rules in this .htaccess file.

A sort of odd inquiry that may benefit others!

For those of us that have long lists of IP ranges in directives, would the processing perhaps be faster is the Ranges were broken into smaller multiple blocks?

Thanks

Don

jdMorgan

7:18 pm on Jan 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, but you'd need to use the [S]kip flag in most well-organized .htaccess files, so that only a few rules would be skipped (in your example, the rule in each 'group') and code using the [S] flag is very difficult to maintain, because you have to specify a fixed number of rules to skip. So that means if you add or delete a rule following the skip flag, but within its range of rules to be skipped, you have to go back and modify the skip-count or your code may break or behave unexpectedly. Therefore, I don't recommend using this technique, except in a very small number of cases where the code function is well-defined and "very self-contained." (That's probably not very clear, but it's the only way I can think of to put it.)

Jim

[edited by: jdMorgan at 7:28 pm (utc) on Jan. 31, 2009]