Forum Moderators: phranque
(images|pict/images)/
Please assume my regular expression (images|pict/images)/[^/.]+\.(jpe?g|gif|png|ico)|\.(css|js)
is correct.
RewriteCond %{HTTP_REFERER} !^https://www\.google\.
<snip>
91.239.168.1 - - [01/Nov/2015:14:33:59 +0100] "GET /images/myImage.jpg" 200 68613 "http://www.google.pl/blank.html" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36"
RewriteCond %{HTTP_REFERER} !^https?://example.com [NC]
RewriteCond %{HTTP_REFERER} !^https://www\.google\.
RewriteCond %{REQUEST_URI} %1
The referrer [google.pl...] should be trapped by
RewriteCond %{HTTP_REFERER} !^https://www\.google\.
The error in the code doesn't lay there.
Did you mention [^/.] in some situations should be [^/\.]
The docs tells no escaping necessary inside square brackets. Sometimes it different.
Some characters in certain positions do need to be escaped.
missing a slash prefix
so for example some mods require \/ (the way Javascript does)
Unlike mod_setenvif, you can't override the space-escape requirement by wrapping it all in quotation marks.
...this part doesn't belong in a RewriteCond anyway; it should be in the body of the rule.
I would assume it's only where the slash is used to delimit the regex? Is that not the case?
I always thought you could?
RewriteCond %{HTTP_USER_AGENT} " Firefox/[34]"
has the intended result, i.e. the rule it's attached to will execute-- and will not execute if you prepend a ! to the condition. (I was testing in Firefox whatever-number-they're-currently-up-to.) Now, what if you're matching against a query string, so a literal equals sign happens to be the very first thing in your test string?
RewriteCond %{REQUEST_URI} "=/test/some file.php"