All the time I wished I could blame Canada

There are many times I wish I could just blame Canada for many of the issues that happen. Lately, many parts of Snat.co.uk has been a target of DDOS attacks and it always seems to start in Canada.

Also, I got an order for a product that I was selling and someone brought it however the person ended up being a scammer (Asking PayPal to refund, then trying to get me to refund it as well “outside of PayPal”) and the details that were recorded was that the person came from Canada.

Now, that aside and that Canada is a nice place (Or so I hear, still don’t wanna go there 😉 ) but after this, I decided that enough was enough so I decided to look into many ways to block different countries (Not Canada) but other very high-risk places like Iran so I decided to have a look into some solutions and I have found three ways that work the best.

The first way was blocking them via .htaccess and that is a failsafe method as it will just work (Apache is needed) however the list IPs can change and therefore you need to update it often (It is possible to do this automatically but that is a post for another day).

Once you have a list of all the IP addresses for the country you want to block (Have a look on Google) just put the following code into your .htaccess file (127.0.0.1 is the part you want to change).

order allow,deny
deny from 127.0.0.1
allow from all

You also might want to put comments so you know which one is which (# is used for comments). The next method was using MaxFraud and PHP to block them. I won’t go into the PHP code that I used (A post for another day) but it worked just as well as .htaccess as I only needed to re-download the MaxFraud database when it was updated (Or use their API which I believe they have).

The final method was to use a web service that I found called Traffic Cleaner and it worked well as it updates by itself and you can forward the banned users to any page that you wish (http://snat.co.uk/blocked) just as long as you don’t have the same Javascript code is gives ya. The only problem that I saw is it used Javascript which sadly can be turned off via the user’s web browser.

My advice, use more than one method to block any users you don’t want accessing your site.

Seeing the title topic says Blame Canada and I am a massive South Park fan (Just look at my name), here is a link to a post that I posted at some point in this blog life called – Robin Williams – Blame Canada (South Park).

Enjoy 😉

Need to reference?

Ellis, M. (2008). All the time I wished I could blame Canada. [online] Snat's Narratives & Tales. Available at: https://snat.co.uk/rants/all-the-time-i-wished-i-could-blame-canada.html [Accessed 21 Nov 2024].

Thanks for reading! You may be interested in this …

Join the Discussion

There are many times I wish I could just blame Canada for many of the issues that happen. Lately, many parts of Snat.co.uk has been a target of DDOS attacks and it always seems to start in Canada. Also, I got an order for a product that I was selling and someone brought it however ... Read more

Add to the discussion!

This site uses Akismet to reduce spam. Learn how your comment data is processed.