ios - 即使使用 htaccess/htpasswd 也检测苹果触摸图标

标签 ios apache .htaccess

我目前有一个设置,在 Apache 服务器上有一个 htaccess 文档,限制网站的访问,如下所示:

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

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

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

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

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

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

最佳答案

我花了一段时间才找到它,但这是我的答案的解决方案。 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>

关于ios - 即使使用 htaccess/htpasswd 也检测苹果触摸图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29135748/

相关文章:

ios - 标题未使用 json 设置。 objective-c

ios - 错误 : CocoaPods's specs repository is too out-of-date to satisfy dependencies. 要更新 CocoaPods 规范,请运行:pod repo update

apache - HTTP ://localhost:8080/Access Error: 404 -- Not Found Cannot locate document:/

apache - 如何增加 AWS 工作人员层实例的超时时间?

php - 在 css 文件中使用 php 代码创建动态 css 每次都不起作用..有时动态 css 不加载只加载 css 中的静态规则

.htaccess - 如何在 301 重定向中使用 RewriteRule URL

ios - 应用程序中的状态栏消失了(Xcode iphone)

iphone - Objective-C for循环问题

java - 无法使用 Apache Commons CSV 读取 CSV 文件 - IllegalArgumentException

.htaccess - RewriteRule 和数字符号 “#”