After several months of fighting with manual comment spam, I have decided to block all the traffic coming from India. All they do is just post useless comments everyday, which made me wonder if its their job to post spam.
Anyway, blocking people by IP is very straight forward using htaccess. I will show two ways on how we can block browsers based on their
IP addresses.
Blocking by IP block is not a very good idea because you will also block legitimate traffics too. Normally, you will do this in at least a week duration and then lift the restriction back to normal.
India's IP block that is
spamming me non-stop is122.180.0.0. Adding the following code below to the htaccess, blocks all traffic coming from that IP block. You can also block specific IP by writing its entire IP address.
order allow,deny
deny from 122.180.
deny from 123.123.123.123
allow from all
Redirect Traffic to a specific page
Redirecting the traffic to a page might be useful instead of just giving them the 403 error page. What is did is to redirect all the traffic from India to a Rick Rolled YouTube page, lol.
RewriteCond %{REMOTE_ADDR} ^122\.180\.\d+\.\d+$
RewriteRule .* http://www.youtube.com/watch?v=ZOU8GIRUd_g [R=302,L]
R=302 is a status code for temporary redirect and L stands for Last as in the last line. You can add more RewriteCond IP addresses by inserting an addtional line before the RewriteRule Line.
Hello Alfredo Sanchez,
I really appreciate your every post and the time you expand for sharing informative informations with your visitors.
And feel Sorry about those India's IP Spammer who spamming your blog.
Yes, you can do this thing but maybe no all are spammers and that is really bad. You may lose important visitors and maybe clients to. I really don t know if it is good.
I've been an SEO for about a year and a half now and I'm horrified by how exposed people's blogs are -especially those in the online industry!
I have a 1 day approval window on my own blog. After that all comments have to be manually approved. Plus I get an email notification of all comments.
I would suggest doing the same if you want to keep your site spam free.
It was a nice post.I think it is very helpful.Thanks for information about IP adress.
Very informative post. Sorry to see the comment section being spammed ;)
is there a way to get the spamming ip behind a proxy?