5 ms·
A bit off topic, please consider the following example in [1]: if ($args ~ post=140){ rewrite ^ http://example.com/ permanent; } Why is "^" used as a
by ez77 16y ago
A bit off topic, please consider the following example in [1]:
if ($args ~ post=140){
rewrite ^ http://example.com/ permanent;
}
Why is "^" used as a regex wildcard instead of ".*"? Thanks!
[1] http://wiki.nginx.org/HttpRewriteModule http://wiki.nginx.org/HttpRewriteModule
- tedjdziuba 16y agoIn Soviet Russia, regex starts you.
- njs12345 16y agoI think that regex matches any string as well - ^ simply matches the start of a line and all strings have a start. It might also be more performant because the regex engine doesn't consume the whole string before finding a match..
- mnutt 16y agoThat is exactly right. See "Taxing Rewrites" on http://wiki.nginx.org/Pitfalls http://wiki.nginx.org/Pitfalls
- tedjdziuba 16y agoIn Soviet Russia, regex starts you.