Proper way to block Referer Spam in .httpd by keyword

hchoate1

Registered
May 29, 2012
4
0
51
cPanel Access Level
Website Owner
I am being plagued by referrer spam that is spoofing as Goodle and am tired of playing whack-a-mole with the IPs so instead would like to block any referals that contain the phrase

Article Dashboard

regardless who it is from for all sites.

Will this do it:?


<Directory "/home/*/public_html">
setenvifnocase referer "^http://.*(Article Dashboard)" spam_ref=1
Order Allow,Deny
Allow from all
Deny from env=spam_ref
</Directory>

And is it the proper syntax to include in httpd.conf via

Pre VirtualHost Include in WHM

Thanks much.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Do you have mod_security installed? You might instead consider using mod_security for restricting these type of access. Here's a guide on using mod_security for this type of block:

Stopping Comment / Referrer Spam
 

hchoate1

Registered
May 29, 2012
4
0
51
cPanel Access Level
Website Owner
Thanks for the suggestion. Apparently mod_security is not installed but that can probably be done.

In the meantime, do you know

Can mod_security be used in httpd.conf so I don't have to update all the .htaccess files?
Does mod_security handle phrases as well as single words- the docs are not clear on that?
Will my original scenario work?

Thanks much.