Apache use .htaccess file to shield wget download site content

It was found that although wget follows the rules of robots.txt, that one can still go around and now share the shielding method I used myself:

1. Block download any file

.htaccess

1
2
3
4
5
6
SetEnvIfNoCase User-Agent "^wget" bad_bot

Order Allow,Deny

Allow from all

Deny from env=bad_bot

2. Block download of partial files

.htaccess

1
2
3
4
5
6
7
8
SetEnvIfNoCase User-Agent "^Wget" bad_bot
SetEnvIfNoCase User-Agent "^Wget/1.5.3" bad_bot
SetEnvIfNoCase User-Agent "^Wget/1.6" bad_bot
Order Allow,Deny
Allow from all
Deny from env=bad_bot

WeChat public number search “Script Home, Select attention

Programs, events, book delivery and other activities are waiting for you

Leave a Reply