欢迎光临

    您好,欢迎光临我的博客。有关于外贸方面,电子商务,网站建设,魔兽RPG,魔兽真三,可与我进行交流探讨。有需要网站建设,Zencart外贸建站,Zencart模板,Wordpress博客,日本剧情片资源、种子等各种需要各种服务请与我联系,希望我能给您提供专业和温馨的帮助)
    人才编号:110179122
    资格证书编号:00200912110000036156
    展业证编号:02002311010580002010000294
    学历:大学本科
    毕业院校:福建农林大学
    我的邮箱:atmshowing@yahoo.com
    加我的QQ 点这里加我QQ
    我的助理   点这里加我QQ
    我的MSN  点这里加我MSN

zencart如何屏蔽国内IP,要求通过密码访问

http://tools.dynamicdrive.com/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” 外的所有文件。

3 Responses to “zencart如何屏蔽国内IP,要求通过密码访问”

3 Comments

  1. 北大青鸟 说道:

    哎,上个课真是无聊啊,博主啊,我来过了》。。。

  2. 夜光粉 说道:

    喜欢一种声音是微风吹落露珠

    欣赏一幅图画是朗月点缀星空

    祝福一位朋友是笑看留言的你

    喜欢一种声音是微风吹落露珠

    欣赏一幅图画是朗月点缀星空

    祝福一位朋友是笑看留言的你

  3. WP Themes 说道:

    Good dispatch and this fill someone in on helped me alot in my college assignement. Gratefulness you as your information.

Leave a Reply

You must be logged in to post a comment.