1. 程式人生 > >過濾和禁止中國IP地址訪問的方法

過濾和禁止中國IP地址訪問的方法

 做英文共享軟體的作者,為了防止軟體被破解,經常需要設定禁用中國地區的IP地址,但很多人不知道怎麼進行設定。

  如何在apache主機上設定禁用中國的IP地址訪問,其實很簡單,修改apache的.htaccess檔案,在檔案中加入下面的語句,即可阻止大部分中國使用者的訪問。當然,這份IP過濾表有些舊,某些新的IP會漏網,可以適當進行一些修改。

  當然,英文網站大多不需要中文使用者,如果想阻止中國的搜尋引擎對其網站進行索引,也可以利用下面的語句。

deny from 61.52
deny from 61.53
deny from 61.54
deny from 61.131
deny from 61.132
deny from 61.133
deny from 61.134
deny from 61.135
deny from 61.136
deny from 61.137
deny from 61.138
deny from 61.139
deny from 61.140
deny from 61.141
deny from 61.142
deny from 61.143
deny from 61.144
deny from 61.145
deny from 61.146
deny from 61.147
deny from 61.148
deny from 61.149
deny from 61.150
deny from 61.151
deny from 61.152
deny from 61.153
deny from 61.154
deny from 61.155
deny from 61.156
deny from 61.157
deny from 61.158
deny from 61.159
deny from 61.160
deny from 61.161
deny from 61.172
deny from 61.173
deny from 61.174
deny from 61.175
deny from 61.176
deny from 202.4.252
deny from 202.4.253
deny from 202.4.254
deny from 202.4.255
deny from 202.97
deny from 202.98
deny from 202.99
deny from 202.100
deny from 202.101
deny from 202.102
deny from 202.103
deny from 202.104
deny from 202.105
deny from 202.106
deny from 202.107
deny from 202.108
deny from 202.109
deny from 202.110
deny from 202.111
deny from 202.112
deny from 202.113
deny from 202.114
deny from 202.115
deny from 202.130.224
deny from 202.130.225
deny from 202.130.226
deny from 202.130.227
deny from 202.130.228
deny from 202.130.229
deny from 202.130.245
deny from 211.81
deny from 211.82
deny from 211.90
deny from 211.91
deny from 211.102
deny from 211.149
deny from 211.150
deny from 211.151
deny from 211.152
deny from 211.153
deny from 211.154
deny from 211.155
deny from 211.156
deny from 211.157
deny from 211.158
deny from 211.159
deny from 211.160
deny from 211.161
deny from 211.162
deny from 211.163
deny from 218.5
deny from 218.21
deny from 218.28
deny from 218.29
deny from 218.71
deny from 218.72
deny from 218.73
deny from 218.74
deny from 218.75
deny from 218.76
deny from 218.77
deny from 218.78
deny from 218.79
deny from 218.80
deny from 218.81
deny from 218.82
deny from 218.83
deny from 218.84
deny from 218.242