Etanisla Posted January 10, 2005 Posted January 10, 2005 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... Quote
charle97 Posted January 10, 2005 Posted January 10, 2005 >RewriteEngine On RewriteCond %{HTTP_REFERER} ^spamdomain.com [OR] RewriteRule .* - [F,L] Quote
Etanisla Posted January 10, 2005 Author Posted January 10, 2005 >RewriteCond %{HTTP_REFERER} ^spamdomain.com [OR] Doesn't the "^" mean "must start with"? Quote
charle97 Posted January 10, 2005 Posted January 10, 2005 yes. try it and see if the change does what you want. Quote
Etanisla Posted January 10, 2005 Author Posted January 10, 2005 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.