我如何禁止除使用htaccess文件的一个国家以外的所有国家?

时间:2019-11-12 16:08:43

标签: .htaccess

我如何禁止除一个国家以外的所有国家,也禁止该国的某些IP?

RewriteEngine On
##################
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


RewriteCond %{HTTP_USER_AGENT} ^.*(googlebot|bingbot|Baiduspider|crawler|AltaVista).*$ [NC]

RewriteRule .* - [R=403,L]

ErrorDocument 403 /.ssi/404.html

GeoIPEnable On
# Put countries to allow here
SetEnvIf GEOIP_COUNTRY_CODE SE AllowCountry
Deny from all
Allow from env=AllowCountry

0 个答案:

没有答案
相关问题