【问题标题】:Detect apple touch icon even though htaccess/htpasswd is used即使使用 htaccess/htpasswd 也能检测到苹果触摸图标
【发布时间】:2015-04-28 14:49:14
【问题描述】:

我目前有一个设置,我在 Apache 服务器上有一个 htaccess 文档,从而限制了网站的访问:

AuthUserFile /myapps/.htpasswd
AuthName EnterPassword
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>

这会提示网站访问者输入用户名和密码(在 .htpasswd 文件中指定)。

这很适合我的目的(在 HTML 中显示原型)。

在智能手机或平板电脑上测试原型时,我希望能够显示苹果触控图标。但是,由于 .htaccess,对apple-touch-icon.png 的请求失败。

有没有办法在不改变 htaccess/htpasswd 设置的情况下解决这个问题?

我可以将苹果触摸图标移动到其他位置,但我无法(不够熟练?:))将我的安全/身份验证设置更改为其他位置。毕竟是原型,没有真正的应用。

【问题讨论】:

    标签: ios apache .htaccess


    【解决方案1】:

    我花了一段时间才找到它,但这是我的答案的解决方案。 FilesMatch 采用正则表达式,允许您从身份验证中排除某些文件。

    AuthUserFile /home/user/.htpasswd
    AuthName EnterPassword
    AuthType Basic
    require valid-user
    
    # Allow access to apple touch icon without authing
    <FilesMatch "(apple-touch-icon\.png)">
      Allow from all
      Satisfy any
    </FilesMatch>
    

    【讨论】:

      猜你喜欢
      • 2015-07-16
      • 2012-10-14
      • 2013-03-20
      • 1970-01-01
      • 1970-01-01
      • 2012-11-29
      • 2011-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多