How to block visitors from visiting your website using htaccess

| Last Updated: | In: Freebies

In this tutorial i have shared how to block visitors from visiting your website using htaccess. Lets assume someone is spamming your website from specific IP address to loose your website’s traffic.

Now you can block visitors to access your website from IP address using htaccess code. below is the simple code to block visitor spamming your website.

Copy paste below code to a text file and upload it to the root directory of your website. Then rename it to “.htaccess”. You can also generate htaccess file from this tool click here. You can also add multiple IP addresses in below code Deny from by copy the same line of code.

Block IP Address using Cpanel

You can also block IP address by logging into Cpanel.
Step 1) Login to cPanel and search IP Blocker, click on IP Blocker option.

Step 2) Enter IP address or domain name which you want to block.
Step 3) Click the Add button.

Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool tutorials.

Tags: , , , , , ,

About: Prem Tiwari

Prem Tiwari is the founder of and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.

You may also like:

Follow us!

Get Free Access of 400+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Free Guide: Learn how to implement security guideline in your WordPress site...


Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...