Jump to content

Recommended Posts

Posted

After reading many helpful posts about using .htaccess to block bad refers, I almost understand it.

 

Except...

 

I'm trying to block (for example) ://random.spamdomain.com by using

>RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?spamdomain.com.*$ [OR]
RewriteRule .* - [F,L]

But that didn't work. It will only block ://www.spamdomain.com or ://spamdomain.com. If the spammer adds a subdomain to it (or in the case I'm thinking of, two) like ://random.stuff.spamdomain.com, then it gets through.

 

What am I missing? I feel like I'm just one character short of enlightenment here...

Posted

Made the change last night, along with a few other experiments on different spamdomains.

 

^spamdomain.com didn't work...

 

but

>^http://(www\.)?.*(-|.)spamdomain.com.*$

did work. Time to study regular expressions again.

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...