【问题标题】:HTTP Basic Auth Upon Image View (.htaccess)图像视图上的 HTTP 基本身份验证 (.htaccess)
【发布时间】:2013-12-27 20:38:59
【问题描述】:

我看到了这个,我很想知道如何重新创建它。不幸的是,我不知道 .htaccess。

在查看图像时,会出现一个 HTTP 基本身份验证样式对话框,要求输入某种身份验证(尽管实际上没有提交任何内容)。

对于这个打滑的问题,我很抱歉,但我真的很想了解如何使用 .htaccess 或 .htpasswd 来完成这项工作。

谢谢。

【问题讨论】:

    标签: .htaccess http authentication .htpasswd


    【解决方案1】:

    在您的 apache 站点配置文件中,添加如下内容:

    Alias /image /path/to/img
     <Directory "/path/to/img">
         AuthType Basic
         AuthName "LoginImage"
         AuthUserFile /path/to/.htpasswd
         Require valid-user
      </Directory>
    

    然后,使用以下命令创建 .htpasswd 文件:

    htpasswd -c .htpasswd someusername
    

    系统会提示您创建密码。

    【讨论】:

      猜你喜欢
      • 2013-05-24
      • 2016-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-21
      • 2011-11-12
      • 2011-05-05
      • 1970-01-01
      相关资源
      最近更新 更多