Jump to content

need help writing a proper rule to block referrer in htaccess


schwim

Recommended Posts

Hi there guys!

I'm having a problem on one of my community sites:

My referrers are being spammed.  It was easy to block initially, because keywords were in the URL's that would never be found in a legitimate keyword for my site, and I could safely block them.  Now the spammers are using ambiguous URL's in hopes of a click to sell their wares, no longer relying on keywords in the URL:

Old referrer: http:// www . buyillegalviagra . com
New referrer: http:// www . mormonsarecool . com/#

the majority of the spam referrers have "/#" appended to them, so I thought I'd simply add a rule blocking that, but I'm having a problem doing that.  Here's my current method of blocking via htaccess:

[code]
SetEnvIfNoCase Referer "^/\#" BadReferrer

order deny,allow
deny from env=BadReferrer
deny from 80.227.0.153
deny from 69.16.200.85

<Files 403.shtml>
order deny,allow
allow from all
</Files>


ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
[/code]

but it's not working.  I created a page linking to my site on another domain, and accessed it with a pound sign at the end of the URL, and when linking, it doesn't get blocked.

How do I get my current rule to block any referrers ending with "/#"?

I'm very appreciative of any help you might be able to provide.

thanks,
json
Link to comment
Share on other sites

Wehheell, thanks for everything guys!

It may take me some time to try all of these suggestions, but I promise I will get back to you with a full report of how each of these worked.  It's the least I can do for all the time you've put into it.

Again, thanks so much.  I'm humbled at the level of enthusiasm.

thanks,
json
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.