{"id":1078,"date":"2015-02-04T11:10:16","date_gmt":"2015-02-04T15:10:16","guid":{"rendered":"http:\/\/www.blogseye.com\/?p=1078"},"modified":"2015-02-17T12:50:40","modified_gmt":"2015-02-17T16:50:40","slug":"htaccess-entry-magically-blocks-90-of-spam","status":"publish","type":"post","link":"http:\/\/blogseye\/2015\/02\/htaccess-entry-magically-blocks-90-of-spam.html","title":{"rendered":"htaccess entry magically blocks 90% of spam"},"content":{"rendered":"

I have noticed that the new plugin mostly catches hits with no Accept header or no User-Agent. All browsers send these headers when they access a web page. Robots are hitting wp-comments and wp-login over and over again without an Accept header and mostly without a user agent.
\nThis made testing the plugin’s other functions difficult so I disabled it and started getting some spam. I enabled it again and the spam stopped.
\nIt turns out that there must be lots of zombie sites using some code that does not send out the accept header, and some of them manage to leave spam before they are reported to SFS. I also put lots of ip blocks on the Allow List, and sometimes these get through, although it is a temporary problem.<\/p>\n

I did some research and found it is possible to block these types of hits on my sites using .htaccess. I added these after the Order<\/code> directive in the htaccess file. If you don’t have an order directive, just add this code to the top of the file.<\/p>\n

SetEnvIf Accept ^$ bad_bot
\nSetEnvIf User-Agent ^$ bad_bot
\nDeny from env=bad_bot<\/code><\/p><\/blockquote>\n

The only drawback is that my installation of OwnCloud.org<\/a> is being blocked. I had to add an Allow from All<\/code> to that folder in order to undo the Deny stuff. I am heavily using OwnCloud now for development as it allows me to work on personal projects at my home desktop computer, on the road on my laptop, and at work (when no one is looking).<\/p>\n

It is truly amazing how much crap is being blocked by the three lines above.<\/p>\n

Please don’t link to this page. If the spammers find out about this they might fix it.<\/p>\n","protected":false},"excerpt":{"rendered":"

I have noticed that the new plugin mostly catches hits with no Accept header or no User-Agent. All browsers send these headers when they access a web page. Robots are hitting wp-comments and wp-login over and over again without an Accept header and mostly without a user agent. This made testing the plugin’s other functions […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/posts\/1078"}],"collection":[{"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/comments?post=1078"}],"version-history":[{"count":3,"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/posts\/1078\/revisions"}],"predecessor-version":[{"id":1099,"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/posts\/1078\/revisions\/1099"}],"wp:attachment":[{"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/media?parent=1078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/categories?post=1078"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blogseye\/wp-json\/wp\/v2\/tags?post=1078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}