Hostwinds 教程

寻找结果为:


目录


编辑.htaccess文件
在下面添加您要禁止的国家/地区

如何阻止访问您的网站

标签: cPanel 

编辑.htaccess文件
在下面添加您要禁止的国家/地区

当您有一个网站时,您想尽可能多地带来交通,但有时候,在那里发现一些不一定的行为者并不一定是最好的意图。在这些喜欢这些时,您可以选择通过阻止您认为恶意的人来保护您的网站。您不仅有能力阻止单个IP,而且还可以做几个甚至整个国家。本文中的步骤将通过将这些块添加到您的.htaccess文件中。

编辑.htaccess文件

1.登录CPanel。 一旦进入,选择文件管理器

2.导航到文档root,这是public_html目录。

3.能够查看.htaccess

  • 导航到右上角点击 设定值
  • 在您的首选项中,选择要编辑的域的文档root,然后单击 在OrecomencEscElect中显示隐藏文件。

4.在您的域文档root中,选择.htaccess文件并单击 编辑 在上方工具栏中。

5.一旦您在编辑器中,您可以添加下面的块以禁止单个主机,其中替换IP地址八位字节的XXX。

订购允许,
拒绝拒绝来自XXX.XXX.XXX.XXX/32
拒绝来自XXX.XXX.XXX.XXX/32
允许所有人

6.根据国家代码禁止,添加如下的块。 在这个例子中,我们使用美国(美国),加拿大(CA)和墨西哥(MX)。

\
GeoIPEnable On

在下面添加您要禁止的国家/地区

SetEnvIf GEOIP_COUNTRY_CODE美国DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE CA DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE MX DenyCountry
全部允许
来自env = DenyCountry的拒绝

以下是国家/地区代码的完整列表。

  • 广告,"安道尔"
  • AE,"阿拉伯联合酋长国"
  • af,"阿富汗"
  • AG,"Antigua和Barbuda"
  • 艾,"安圭拉"
  • al,"阿尔巴尼亚"
  • 我,"亚美尼亚"
  • AO,"安哥拉"
  • AP,"亚太地区"
  • AQ,"南极洲"
  • AR,"阿根廷"
  • "美国萨摩亚"
  • 在"奥地利"
  • AU,"澳大利亚"
  • AW,"阿鲁巴"
  • 斧头,"奥兰群岛"
  • AZ,"Azerbaijan"
  • BA,"波斯尼亚和黑塞哥维那"
  • BB,"巴巴多斯"
  • BD,"孟加拉国"
  • 是,"比利时"
  • BF,"Burkina Faso"
  • BG,"保加利亚"
  • BH,"巴林"
  • BI,"Burundi"
  • BJ,"贝宁"
  • BL,"圣巴特雷米"
  • BM,"百慕大"
  • BN,"文莱达鲁萨兰"
  • 博,"玻利维亚"
  • BQ,"Bonaire,Saint Eustatius和Saba"
  • BR,"巴西"
  • BS,"巴哈马"
  • BT,"不丹"
  • BV,"Bouvet Island"
  • BW,"博茨瓦纳"
  • 通过,"白俄罗斯"
  • BZ,"伯利兹"
  • CA,"加拿大"
  • CC,"Cocos(Keeling)群岛"
  • CD,"刚果,民主共和国"
  • CF,"中非共和国"
  • CG,"刚果"CH,"瑞士"
  • ci,"cote d'ivoire"
  • CK,"库克群岛"
  • CL,"智利"厘米,"喀麦隆"
  • CN,"中国"CO,"哥伦比亚"
  • CR,"哥斯达黎加"铜,"古巴"
  • CV,"Cape Verde"
  • CW,"Curacao"
  • CX,"圣诞岛"
  • CY,"塞浦路斯"
  • CZ,"捷克共和国"
  • de,"德国"
  • DJ,"吉布提"
  • DK,"丹麦"
  • DM,"多米尼加"
  • 做,"多米尼加共和国"
  • DZ,"阿尔及利亚"
  • 欧共体,"厄瓜多尔"
  • ee,"爱沙尼亚"
  • 例如,"埃及"
  • 呃,"西撒哈拉"
  • 呃,"厄立特里亚"
  • es,"西班牙"
  • et,"埃塞俄比亚"
  • 欧盟,"欧洲"
  • fi,"芬兰"
  • FJ,"Fiji"
  • FK,"Falkland Islands(Malvinas)"
  • FM,"密克罗尼西亚,联邦州"
  • Fo,"Faroe Islands"
  • FR,"法国"
  • Ga,"Gabon"
  • GB,"英国"
  • GD,"格林纳达"
  • GE,"格鲁吉亚"
  • gf,"法国圭亚那"
  • GG,"Guernsey"
  • GH,"加纳"
  • GI,"直布罗陀"
  • GL,"格陵兰"
  • 通用汽车"冈比亚"
  • GN,"几内亚"
  • GP,"Guadeloupe"
  • GQ,"赤道几内亚"
  • gr,"希腊"
  • GS,"南乔治亚和南三明治群岛"
  • GT,"危地马拉"
  • 顾,"关岛"
  • GW,"几内亚比绍"
  • gy,"圭亚那"
  • 香港,"香港"
  • 嗯,"听到岛屿和麦当劳群岛"
  • HN,"洪都拉斯"
  • 人力资源,"克罗地亚"
  • ht,"海地"
  • 胡,"匈牙利"
  • ID,"印度尼西亚"
  • 即"爱尔兰"
  • IL,"以色列"
  • 我,"人的小岛"
  • 在印度"
  • io,"英国印度洋围岩"
  • 智商,"伊拉克"
  • IR,"伊朗,伊斯兰共和国"
  • 是,"冰岛"
  • 它,"意大利"
  • je,"泽西岛"
  • JM,"牙买加"
  • 乔,"约旦"
  • jp,"日本"
  • ke,"肯尼亚"
  • kg,"吉尔吉斯斯坦"
  • kh,"柬埔寨"
  • ki,"基里巴斯"
  • km,"科摩罗"
  • kn,"圣基茨和尼维斯"
  • KP,"韩国,民主党人共和国"
  • KR,"韩国,共和国"
  • kw,"科威特"
  • KY,"Cayman Islands"
  • KZ,"哈萨克斯坦"
  • 洛杉矶,"老挝人民民主共和国"
  • LB,"黎巴嫩"
  • LC,"圣卢西亚"
  • 李,"列支敦士登"
  • LK,"斯里兰卡"
  • LR,"利比里亚"
  • LS,"莱索托"
  • LT,"立陶宛"
  • 鲁,"卢森堡"
  • LV,"拉脱维亚"
  • LY,"利比亚阿拉伯贾马希里亚"
  • 马,"摩洛哥"
  • MC,"摩纳哥"
  • MD,"摩尔多瓦,共和国"
  • 我,"黑山"
  • MF,"圣马丁"
  • Mg,"马达加斯加"
  • MH,"马绍尔群岛"
  • MK,"马其顿"
  • ml,"马里"mm,"缅甸"
  • Mn,"蒙古"
  • 莫,"澳门"
  • MP,"北马里亚纳群岛"
  • MQ,"Martinique"
  • 先生,"毛里塔尼亚"
  • 女士,"蒙特塞拉特"
  • MT,"马耳他"
  • 穆,"毛里求斯"
  • MV,"马尔代夫"
  • MW,"Malawi"
  • MX,"墨西哥"
  • 我的,"马来西亚"
  • MZ,"莫桑比克"
  • na,"纳米比亚"
  • NC,"新喀里多尼亚"
  • ne,"尼日尔"
  • NF,"诺福克岛"
  • ng,"尼日利亚"
  • ni,"尼加拉瓜"
  • NL,"荷兰"
  • 不,"挪威"
  • NP,"尼泊尔"
  • nr,"瑙鲁"
  • nu,"niue"
  • 新西兰"新西兰"
  • om,"阿曼"
  • PA,"巴拿马"
  • pe,"秘鲁"
  • PF,"法属波利尼西亚"
  • PG,"巴布亚新几内亚"
  • ph,"菲律宾"
  • PK,"巴基斯坦"
  • PL,"波兰"
  • PM,"圣皮埃尔和迈克仑"
  • pn,"pitcairn"
  • PR,"Puerto Rico"
  • PS,"巴勒斯坦领土"
  • Pt,"葡萄牙"PW,"帕劳"
  • py,"paraguay"
  • QA,"卡塔尔"
  • 重新,"reunion"
  • ro,"罗马尼亚"
  • 卢比,"塞尔维亚"
  • 茹,"俄罗斯联邦"
  • rw,"rwanda"
  • SA,"沙特阿拉伯"
  • SB,"所罗门群岛"
  • SC,"塞舌尔"
  • SD,"苏丹"
  • SE,"瑞典"
  • SG,"新加坡"
  • Sh,"圣赫勒拿"
  • SI,"斯洛文尼亚"
  • SJ,"Svalbard和Jan Mayen"
  • SK,"斯洛伐克"
  • SL,"Sierra Leone"
  • SM,"圣马力诺"
  • Sn,"塞内加尔"
  • 所以,"索马里"
  • SR,"苏里南"
  • SS,"南苏丹"
  • 圣,"圣多美和普林西比"
  • SV,"El Salvador"
  • SX,"Sint Maarten"
  • SY,"阿拉伯叙利亚共和国"
  • SZ,"斯威士兰"
  • TC,"土耳其人和凯科斯群岛"
  • TD,"Chad"
  • TF,"法国南部地区"
  • TG,"多哥"
  • th,"泰国"
  • TJ,"Tajikistan"
  • TK,"Tokelau"
  • TL,"Timor-Leste"
  • TM,"Turkmenistan"
  • TN,"突尼斯"
  • "汤加"
  • TR,"土耳其"
  • tt,"trinidad和tobago"
  • 电视,"图瓦卢"
  • TW,"台湾"
  • TZ,"坦桑尼亚,联合共和国"
  • ua,"乌克兰"
  • UG,"乌干达"
  • 嗯,"美国小野外岛屿"
  • 美国,"美国"
  • UY,"乌拉圭"
  • uz,"乌兹别克斯坦"
  • VA,"圣洁的看(梵蒂冈市)"
  • VC,"圣文森特和格林纳丁斯"
  • ve,"委内瑞拉"
  • vg,"维尔京群岛,英国人"
  • VI,"维尔京群岛,美国"
  • VN,"越南"
  • VU,"瓦努阿图"
  • WF,"Wallis和Futuna"
  • WS,"Samoa"
  • 你,"也门"
  • yt,"mayotte"
  • ZA,"南非"
  • zm,"赞比亚"
  • ZW,"津巴布韦"

撰写者 Hostwinds Team  /  四月 24, 2018