What should we do if we find out that a certain IP frequently attacks our website or if we want to deny this IP access to our website for other reasons? Let’s share a way to deny access to a certain IP through .htaccess.
Edit the .htaccess file and enter the following content:
order allow,deny deny from 110.120.16.11 deny from 108.8.32. allow from all
Save the above content and put it under the root directory of the site to deny the specified IP from accessing the website. The second line of the above code is to deny the IP address 110.120.16.11 from accessing our site. The third line It is to deny users in the IP range 108.8.32.0 - 108.8.32.255 from accessing our site. Of course what if you want to deny everyone access to your site? Just use deny from all directly. In addition, in addition to filling in the IP address, the prohibited information can also be set by domain name, as follows:
order allow,deny deny from baidu.com deny from www.google.cn allow from all