What should I do if I find that an ip address often attacks our website or I plan to reject the ip address from accessing our website for other reasons? The following describes how to deny access from an ip address through. htaccess.
Edit the. htaccess file and enter the following content:
Order allow, denydeny from 110.120.16.11deny from 108.8.32.allow from all
Save the preceding content and put it under the root directory of the site to reject the specified ip address from accessing the website. In the code above, the second line rejects the ip address 110.120.16.11 from accessing our site, the third line is to reject users in the IP segment 108.8.32.0-108.8.32.255 from accessing our site. Of course, if you want to deny everyone access to your site? Use deny from all directly. In addition to IP addresses, the prohibited information can also be set by domain names, as shown below:
Order allow, denydeny from baidu. comdeny from www. google. cnallow from all
Articles you may be interested in
- How to use. htaccess anti-leech website Images
- Disable the list directory using. htaccess
- Set the default homepage of a website through. htaccess
- How does one modify the default homepage of a website through. htaccess?
- 10 practical. htaccess code snippets
- . Htaccess: how to set images in a directory of anti-leech
- Use Apache htaccess to prevent image leeching
- Use the GZip compression function of PHP to compress website JS and CSS files to accelerate Website access.