The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with blocking particular referrer via .htaccess

Discussion in 'General Discussion' started by schwim, Jan 23, 2007.

  1. schwim

    schwim Well-Known Member

    Joined:
    Aug 2, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Hi there guys,

    I keep about 100 lines in my .htaccess, because without them, my referrers will show 1,000's of hits a day from places trying to sell you poker chips, medicine, realty and more. In spite of the filters, tons gets through, and the majority of them look like this:

    http://www.iwantyourmoney.com/#

    Note the pound sign at the end.

    I've not seen a legitimate link on my site with a pound sign behind the .tld

    Here's my current setup:

    You can see that I block all referrers coming from .info, then a couple of specific IP's, and that's about the jist of it. I tried to block .com/#, .net/#, .info/# and .org/#, however .htaccess thinks the pound sign is the beginning of a comment, and everyone gets blocked, so I tried .com/\#, .net/\#, etc.. but the same thing occurs. Everyone gets blocked.

    How would I write it?

    is what I would like to block literally.

    Any help would be greatly appreciated as the pieces of crap are making me wish I had taken up knitting.

    thanks,
    json
     
  2. schwim

    schwim Well-Known Member

    Joined:
    Aug 2, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    anybody at all?

    thanks,
    json
     
  3. nwilkens

    nwilkens Well-Known Member

    Joined:
    May 4, 2006
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Monroe MI
    cPanel Access Level:
    DataCenter Provider
    mod_setenvif

    Since you are using mod_setenvif to accomplish this, I think you will need to be checking the Request_URI - the portion of the URL following the scheme and host portion.

    Reference: http://httpd.apache.org/docs/1.3/mod/mod_setenvif.html

    So, maybe something like this:

    SetEnvIfNoCase Request_URI "^\#" BadReferrer

    I didn't test it, but it may help..

    Also, you could consider using mod_rewrite to accomplish the same task.

    Hope this helps a bit..
     
  4. schwim

    schwim Well-Known Member

    Joined:
    Aug 2, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    That didn't work, unfortunately. Anybody with some suggested tweaks to it would be appreciated.

    I've read the apache page you linked to, and it seems to me that the line should have worked, so I'm not sure what else to do.

    thanks,
    json
     
Loading...

Share This Page