While I could turn on Rewrite Logging and mess with this rule to figure out what it does (if anything), I bet someone already knows. Here's the rule by itself:
RewriteRule ^ - [L]
Here it is in context:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
I guess it means "Match Everything". I'd have thought that "Match Everything" would be a dot to make it more obvious that there is no missing code, and that regexp would error out if the caret was the only thing in it. So I see the outside chance that it means something else.
There are two main directive of this module: RewriteCond & RewriteRule . RewriteRule is used to rewrite the url as the name signifies if all the conditions defined in RewriteCond are matching. One or more RewriteCond can precede a RewriteRule directive.
The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
NC|nocase. Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner. That is, it doesn't care whether letters appear as upper-case or lower-case in the matched URI. In the example below, any request for an image file will be proxied to your dedicated image server.
^
is a somewhat unorthodox way of saying "match anything", just as you say-
means "take no action"[L]
means "last rule" i.e. stop processing RewriteRules
after this pointI assume there are other rules following this one, because this combination of RewriteCond
/RewriteRule
says that if the current request is for an existing file or directory, mod_rewrite
should ignore any subsequent RewriteRules
.
Expressed in code, this would be equivalent to:
do_rewrites(req)
{
if (is_file(req) || is_dir(req))
return;
// other rules
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With