Forum Moderators: phranque
However for some user agents, particular BecomeBot, the referrer is showing in the logs as "".
Does anyone know what this means (the complete absence of a referrer header perhaps?) and how I could differentiate between "-" and "" in a .htaccess condition?
Userfriendly: RewriteCond %{HTTP_REFERER} ^$ appears to detect both cases, and I'd like to be able to differentiate between them. i.e. write a RewriteCond line which fires when the referrer is present but blank and not when the referrer is absent.
I have found an alternate way to do this though it wasn't as effective as I hoped, because their script still has a default file that it tries to post to if it can't find a form.
What you might want to do is use something like the following to reduce the bandwidth they consume each time they receive a 404 from your server:
Redirect 404 /targetfile.php
<Files targetfile.php>
ErrorDocument 404 "Not found
</Files>
(Note that there is no closing quote mark for the ErrorDocument string.)
I found this trick on a page about reducing the damage caused by the URL-squatting favicon.ico requests. Now, instead of a huge great HTML 404 page, the tiny string "Not found" is returned instead. This costs merely 22 bytes each time compared to the 800+ bytes that my HTML 404 page was sucking up.
You should be able to use this to minimise the cost of repeated requests for your non-existent PHP file.
I am considering that instead of blocking them altogether, I could hand them a dummy form with an action pointing to [nonexistantdomain.com...] Assuming their script falls for this and doesn't just try to post to [mysite.com...] it will save me bandwidth, because they are posting 11kb of data at my site each time. :)
But for weeks afterwards, the spammer was sending occassional tests to the old script URL, then the new script URL. They became less and less frequent, so I'm hoping that the human at the other end has realised that it's not worth his time sending the requests to my domain anymore.
Hopefully the requests to your domain will fade away now you've fixed your problem.