which is the better form to use (and, to help with my education, why)? this one: RewriteCond %{HTTP_REFERER} (kambasoft|semalt|whatever) [NC] RewriteRule .* - [F]
or this one: RewriteCond %{HTTP_REFERER} kambasoft [NC,OR] RewriteCond %{HTTP_REFERER} semalt [NC,OR] RewriteCond %{HTTP_REFERER} whatever [NC] RewriteRule .* - [F]
wilderness
5:50 pm on Aug 10, 2014 (gmt 0)
the combined line will be less server strain and slightly faster.
Both do however work.
I've one for "crawler" as well, however for simplicity sake and to possibly stop another stray bot, you could use "crawl".
lucy24
7:05 pm on Aug 10, 2014 (gmt 0)
The form
#any two numbers RewriteCond %{HTTP_REFERER} ^http://[0-9]{2}\.semalt\.com/
is syntactically correct, but I suspect it's easier on the server if you simply say
^http://[0-9][0-9]\.semalt\.com
That's assuming it will always be exactly two. Otherwise of course you'd go to
[0-9]+
Or-- my preference-- \d for a savings of three bytes ;)
fwiw, mine simply says
SetEnvIf Referer semalt keep_out
It's in mod_setenvif because this rule is in my shared htaccess used by all sites. If it were for a single site it would be expressed as a RewriteCond along with assorted other referer-based lockouts.
My impression is that semalt works 100% via infected human browsers, because they always ask for favicon and stylesheet. Robots normally don't. Did anyone ever figure out what they want?