How to block a specific IP address from accessing the website
[ad_1]
If you've got annoying website visitors, spammers, or site scrapers you'll find helpful to block these users from accessing your site content. You'll be able to block unauthorized unhealthy users by their IP address with the help of a .htaccess file. Before you begin, you need to have the FTP login details, an FTP client, and the Plain text editor.
Steps to block a specific IP address from accessing the website: Secure directories by IP address and domain:
In the below example, all the IP addresses and domains are acceptable, except for 123.456.789 and abcdef.co:
# allow all except those indicated here
order allow,deny
allow from all
deny from 123.456.789
deny from .*abcdef.co.*
In the below example, all the IP addresses are denied access except only for 123.456.789 and abcdef.co:
# Deny access to everyone, except those listed here:
order deny,allow
deny from all
allow from 123.456.789
allow from .*abcdef.co.*
In the below example you will find the steps to block inappropriate visitors based on the domain name. Simply replace "abcdef20″ and "abcdef30″ along with the offending domains of your requirement:
# block visitors referred from indicated domains
RewriteEngine on
RewriteCond %{HTTP_REFERER} abcdef20.co [NC,OR]
RewriteCond %{HTTP_REFERER} abcdef30.co [NC]
RewriteRule .* - [F]
[ad_2]