To ban a single IP address from accessing your Website, add following code to the .htaccess file in the root directory of your html file. If you donot have .htaccess file in your root directory, you can create one. FTP and file manager can help you to create .htaccess file. Please remember the “.” before htaccess. “.” means hidden file.
deny from 79.09.9.8
deny from 221.138.7
allow from all
The above lines tell the Apache Web Server to block visitors from the IP address ‘79.09.9.8’ and ‘221.138.7’, note the second IP address is missing the fourth set of digits, this means any IP address which matches the firth three set of digits will be blocked, e.g. ‘18.104.22.168’ , ‘22.214.171.124’ till ‘126.96.36.199’ would be blocked.
If you want to block every visitors except you to visit your website or any directory. This is especially useful for your wordpress admin directory http://yourwebsitename.com/wp-admin, and other kind of content management software admin directory such as phplinkdirectory admin directory, and vbulletin forum admin directory. You can add following code to your root directory or the the limited directory:
allow from 188.8.131.52
deny from all
‘184.108.40.206’ is your IP address. Above code is very useful to protect your admin folder. If you donot know your IP address, you can ask google. Just in google chrome in the browser line and click ” whay is my IP address “, google will tell you. You can also ask our website, https://domain.powerhoster.com/whats-my-ip-address/