爬虫禁止(写到项目里面的.htaccess)

SetEnvIfNoCase ^User-Agent$ .*(YisouSpider|360Spider|QiaoFang|Baiduspider|Baiduspider-render|YisouSpider|Bytespider|360Spider|sosospider|360spider|youdaobot|jikeSpider|bcebos-spider-1.0|OtherSpider|EasouSpider|Ezooms|JikeSpider|2345Explorer) hanyeBot

Order Allow,Deny

Allow from all

Deny from env=hanyeBot

缓存配置(写到httpd.conf)

在文件下面新添加

#文件请求缓存

<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css)$">

Header set Cache-Control "max-age=2592000, public"

</FilesMatch>

<FilesMatch "\.(html|txt|htm|php)$">

Header set Cache-Control "max-age=2592000, public, must-revalidate"

</FilesMatch>