Block Bots, Leechers, and Ban by IP

htaccess

If you have an offender, always abusing your server or dumping spam through your contact forms… the tutorial below will teach you how to block them from accessing your website. It should be noted, however, that this post is specific to Linux servers with HTACCESS functionality.

Block Bots

The below instructions look for robots that begin with a name of “BadBot” and tells it to go to http://take.a.hike/ which translates to a long walk off a short pier. Adjust accordingly.

Block Leechers (Hotlinkers)

Steeling bandwidth and server resources can cripple your site and ultimately your repeat traffic. No one likes a slow site. To prevent other website from hot linking or leeching your content, use the code below:

The code above will return a 403 Forbidden error to anyone trying to hotlink your images on badwebsite.com. The end result: users on that site will see a broken image, and your bandwidth is no longer being stolen.

Block by IP

My personal favorite… block a person from accessing your website by their IP.

All of the examples above are specific to HTACCESS. If you are on a Windows Server, this will not work for you. Happy blocking!

/ Web Design

Share the Post

About the Author

Tried and true professional with over 14 years in Web development, project management, business development, branding, mobile computing, online marketing & sales, website design, social media and more.