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.
order allow,deny
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. ‘221.138.7.1’ , ‘221.138.7.2’ till ‘221.138.7.255’ 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:
order allow,deny
allow from 207.241.90.37
deny from all
‘207.241.90.37’ 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/