Blocking spam comments (actually all comments) in gallery2 - Fri, Feb 29, 2008
So I spent most of the evening trying to find out how to stem the hoards of spam comments i’ve been getting in gallery2. The captcha system sucks and it doesn’t seem to stop anonymous commenting.
Heres a temp solution before version 2.3 comes out that has a ton of anti-spam features built in. This solution assumes that you are using the short-url module which writes an .htaccess file with a bunch of mod_rewrite crap in it.
Put the following code at the very end of all the pregenerated stuff (but within the IfModule and /IfModule statements)
RewriteCond %{QUERY_STRING} .AddComment.$ RewriteRule ^.*$ - [F]
Basically all that does is returns a 403 Forbidden error with any URL that contains AddComment. Yeah, its stupid. At least this will tide you over since there really isn’t a good way to globally turn off all comments. This isn’t tested very much so buyer-beware.