.htaccess 使用htaccess和GeoIP阻止特定地址或URL的国家/地区

.htaccess 使用htaccess和GeoIP阻止特定地址或URL的国家/地区,.htaccess,block,access-denied,geoip,restrict,.htaccess,Block,Access Denied,Geoip,Restrict,我想限制访问URL或地址的一个或多个特定国家/地区IP,例如“/cart.php?a=checkout”。 如何使用htaccess和Geo IP mod实现这一点?例如,您可以使用以下代码: <FilesMatch "^(cart\.php|viewinvoice\.php)$"> SetEnvIf GEOIP_COUNTRY_CODE DE BlockCountry SetEnvIf GEOIP_COUNTRY_CODE IN BlockCountry SetEnvIf GEO

我想限制访问URL或地址的一个或多个特定国家/地区IP,例如“/cart.php?a=checkout”。
如何使用htaccess和Geo IP mod实现这一点?

例如,您可以使用以下代码:

<FilesMatch "^(cart\.php|viewinvoice\.php)$">

SetEnvIf GEOIP_COUNTRY_CODE DE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE UA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE EC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LV BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE US BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE FR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SG BlockCountry

Order allow,deny
Allow from all
Deny from env=BlockCountry

SetEnvIf GEOIP_COUNTRY_代码DE BlockCountry
块国家/地区中的SetEnvIf GEOIP_国家/地区代码
SetEnvIf GEOIP_国家/地区代码RU区块国家/地区
SetEnvIf GEOIP_国家/地区代码UA区块国家/地区
SetEnvIf GEOIP_国家代码EC区块国家
SetEnvIf GEOIP_COUNTRY_代码VN BlockCountry
SetEnvIf地理区域国家代码CN区块国家
SetEnvIf GEOIP_COUNTRY_代码AM BlockCountry
SetEnvIf GEOIP_COUNTRY_代码LV BlockCountry
SetEnvIf GEOIP_COUNTRY_代码美国区块国家
SetEnvIf GEOIP_国家/地区代码TR区块国家/地区
SetEnvIf GEOIP_COUNTRY_代码FR BlockCountry
SetEnvIf GEOIP_COUNTRY_代码SA BlockCountry
SetEnvIf GEOIP_COUNTRY_代码PL BlockCountry
SetEnvIf地理IP_国家代码NL BlockCountry
SetEnvIf GEOIP_国家代码SG BlockCountry
命令允许,拒绝
通融
拒绝来自env=BlockCountry