zencart外贸网站怎么屏蔽国内IP-www.fobsoho.com
发布:vip | 发布时间: Saturday, June 25, 2011
做外贸,特别是做仿牌外贸,行业之间的竞争非常激烈。为了避免同类行业的恶意竞争,很多做外外贸、仿牌外贸的朋友都不想让国内同行访问自己的外网站、仿牌网站。这里告诉大家zencart网站屏蔽国内IP的方法,希望可以帮到大家。
zencart屏蔽IP功能:
下面的两个地址,可以根据自己的需要选择国家然后生成htaccess文件,接着把这文件上传到你的网站,就能屏蔽某个国家、地区的访客。
网站一:(推荐,可以选择允许或者禁止某个国家的访问)
http:///
网 站二:
http:///
htaccess 中可以除去自己的IP,例如:
order deny,allow <– 注意这里的写法
allow from 220.249.1.2 <– 这里输入自己的IP或IP段
allow from 220.250.3.0/24 <– 这里输入自己的IP或IP段
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:///password/
这些代码需要保存到 .htaccess 文件,并置于需要保护的目录下,例如zencart网店的 admin目录下。
基本的密码保护方法:
代码:
# basic password protection
<IfModule mod_auth.c>
AuthUserFile /home/path/.htpasswd
AuthName "Username and password required"
AuthType Basic
<Limit GET POST>
Require valid-user
</Limit>
</IfModule>
仅某些IP可以访问,其它的需要输入密码:
代码:
# password protect excluding specific ips
<IfModule mod_auth.c>
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
</IfModule>
仅某些IP段的用户访问需要密码,其它IP的用户无需密码:
代码:
# password protect only for specified ips
<IfModule mod_auth.c>
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
</IfModule>
密码保护单个文件:
代 码:
# password protect single file
<IfModule mod_auth.c>
<Files "protected.html">
AuthName "Username and password required"
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
</Files>
</IfModule>
其中 protected.html 是需要输入密码才能访问的文件。
密码保护多个文件:
代码:
# password protect mulitple files
<IfModule mod_auth.c>
<FilesMatch "(protected.html)|(passwords.txt)">
AuthName "Username and password required"
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
</FilesMatch>
</IfModule>
上面指定 “protected.html” 和 “passwords.txt” 文件需要密码才能打开。同样可以加上更多的文件。
密码保护多种文件类型:
代码:
# password protect mulitple file types
<IfModule mod_auth.c>
<FilesMatch ".(inc|txt|log|dat|zip|rar)$">
AuthName "Username and password required"
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
</FilesMatch>
</IfModule>
这样就密码保护了这些类型的文件:.inc, .txt, .log, .dat, .zip, .rar。
密码保护除了某个文件外的所有文件:
代码:
# password protect everything except a single file
<IfModule mod_auth.c>
AuthName "Username and password required"
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
<Files "open-access.html">
Order Deny,Allow
Deny from all
Allow from 123.456.789
Satisfy any
</Files>
</IfModule>
这样就只有访问 open-access.html 这个文件不需要密码,该文件可以是保存在某个子目录中。
密码保护除了某些文件外的所有文件:
代码:
# password protect everything except specified files
<IfModule mod_auth.c>
AuthName "Username and password required"
AuthUserFile /home/path/.htpasswd
Require valid-user
AuthType Basic
<FilesMatch "(open-access-1.html)|(open-access-2.html)|(open-access-3.html)">
Order Deny,Allow
Deny from all
Allow from 123.456.789
Satisfy any
</FilesMatch>
</IfModule>
这样就密码保护除了“open-access-1.html”, “open-access-2.html”, “open-access-3.html” 外的所有文件。
- 相关文章:
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。





