There must be a solid reason to do this. By using the little code below, we can easily make our website accessible or inaccessible to the specific visitors using their IP (You need to know the visitors IP of course).  You need to just copy and paste it in your .htaccess file.

order allow,deny
deny from
deny from 123.45.6.
allow from all

Deny: means IP which you want to block, in the example above, we have blocked two IPs and allowed everyone else. Use this .htaccess wisely. 

Many times web developers work on the live server instead of localhost. In this case, it is good practice to block all IPs but one and develop the site without any worry. To do so, add this to your .htaccess file

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-For} xxx\.xxx\.xxx\.xxx
RewriteRule .* - [F]

Remove xxx\.xxx\.xxx\.xxx and put your IP address.


If you have any issue, let us know in the comment box.