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 xxx.xxx.xx.xxx by copy the same line of code.
# allow all except those indicated here
Deny from xxx.xxx.xx.xxx
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.