Block the visitors through IP address
The facility to block visitors provided by Apache Web Server allows you to deny or allow access to some of your specific visitors. The function is very useful to block not required visitors or it is also used to allow access only to the website owner to access a specific section of the website like the admin area.
To block visitors and setting up restrictions, make an .htaccess file by following the guidance and instructions that include the text below:
Order allow, deny Deny from 6220.127.116.11 Deny from 255.64.4. Allow from all
The deny lines above instruct Apache Web Server for blocking the visitors accessing through their IP address ‘618.104.22.168’ and ‘255.64.4.’. Note here, that the fourth digit sets are missing in the second IP address, so it means that an IP address that will match the first three digit sets will get blocked, for example, ‘255.64.4.12’ and ‘255.64.4.299’ will also be blocked.
For allowing yourself and block all other visitors, make an .htaccess file by following the guidance and main instructions that include the text below:
Order allow, deny Allow from 622.214.171.124 Deny from all
The lines above will instruct Apache Web Server for blocking all the visitors accessing from any other IP except IP address ‘6126.96.36.199’ that should be replaced with your IP.
After the ‘order allow, deny’, you can add unlimited ‘deny from’ and ‘allow from’. Note that in the bottom line the instruction ‘deny from all’ and ‘allow from all’ should be changed according to the requirements. Buy for restricting visitor access, use ‘deny from all’ and place the ‘allow from’ line above it.
The visitors that get blocked will get a message of ‘403 Forbidden’. This error message of error can be customized, for that you need to follow the ‘Document errors’ part mentioned above.