admin管理员组

文章数量:1565292

很多朋友都不想让国内的同行看到自己的网站。于是很多朋友都把自己的外贸仿牌网站设置了国内IP屏蔽,怎么屏蔽国内IP呢?

zencar屏蔽IP功能:

经常有朋友问如何屏蔽某个国家、地区的用户访问网站。下面的网站,可以选择生成.htaccess文件,上传到您的网站后,就能屏蔽某个国家、地区的用户了

网站一:(推荐,可以选择允许或者禁止某个国家的访问)

http://www.countryipblocks/

网站二:

http://www.blockacountry/

htaccess中可以除去自己的IP,例如:

order deny,allow allow from 220.249.1.2 allow from 220.250.3.0/24 deny from 58.14.0.0/15
deny from 58.16.0.0/16
…..

如何通过密码保护网站文件、目录,限制IP地址?

基础知识:
下面提到的 AuthUserFile /home/path/.htpasswd ,用于指定密码文件.htpasswd, 该文件需要手工建立。 /home/path 是用于存放 .htpasswd 文件的目录,相应修改。
Google下能找到很多相关说明,也可以在线生成 .htpasswd 密码文件,例如:http://tools.dynamicdrive/password/

这些代码需要保存到 .htaccess 文件,并置于需要保护的目录下,例如zencart网店的admin目录下。

基本的密码保护方法:
代码:
# basic password protection

AuthUserFile /home/path/.htpasswd
AuthName “Username and password required”
AuthType Basic
Require valid-user

仅某些IP可以访问,其它的需要输入密码:
代码:
# password protect excluding specific ips

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
AuthType Basic
Require valid-user
Order Deny,Allow
Deny from all
Allow from localhost
Allow from 111.222.333.444
Allow from 555.666.777.888
Satisfy Any

仅某些IP段的用户访问需要密码,其它IP的用户无需密码:
代码:
# password protect only for specified ips

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
AuthType Basic
Require valid-user
Order Allow,Deny
Allow from all
Deny from 111.222.333.444
Deny from 555.666.777.888
Satisfy Any

密码保护单个文件:
代码:
# password protect single file

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
其中 protected.html 是需要输入密码才能访问的文件。

密码保护多个文件:
代码:
# password protect mulitple files

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
上面指定 “protected.html” 和 “passwords.txt” 文件需要密码才能打开。同样可以加上更多的文件。

密码保护多种文件类型:
代码:
# password protect mulitple file types

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
这样就密码保护了这些类型的文件:.inc, .txt, .log, .dat, .zip, .rar。

密码保护除了某个文件外的所有文件:
代码:
# password protect everything except a single file

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic

Order Deny,Allow
Deny from all
Allow from 123.456.789
Satisfy any
这样就只有访问 open-access.html 这个文件不需要密码,该文件可以是保存在某个子目录中。

密码保护除了某些文件外的所有文件:
代码:
# password protect everything except specified files

AuthName “Username and password required”
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic

Order Deny,Allow
Deny from all
Allow from 123.456.789
Satisfy any
这样就密码保护除了“open-access-1.html”, “open-access-2.html”, “open-access-3.html” 外的所有文件。

 

本文标签: 屏蔽方法国内网站zencart