[英]Recognize “apple-touch-icon” with htaccess password protection
The question: How can I use a custom iPhone home screen icon while securing my website with .htaccess? 问题:如何在通过.htaccess保护我的网站的同时使用自定义iPhone主屏幕图标?
The setup: 设置:
The problem: I would like to see my custom "apple-touch-icon" when I put a bookmark of my website onto my iPhone home screen using the "Add to Home Screen" function in mobile Safari. 问题:当我使用移动Safari中的“添加到主屏幕”功能将网站的书签放在iPhone主屏幕上时,我想看到自己的自定义“ apple-touch-icon”。 Unfortunately, when I enable "require valid-user" in the .htaccess file, the iPhone does not see the icon and instead uses a generic image.
不幸的是,当我在.htaccess文件中启用“需要有效用户”时,iPhone看不到该图标,而是使用普通图像。 When I disable password protection in .htaccess, the icon is recognized, but I really need some sort of password protection and I hope to continue using the current method.
当我在.htaccess中禁用密码保护时,可以识别该图标,但是我确实需要某种密码保护,并且希望继续使用当前方法。
Any help is appreciated; 任何帮助表示赞赏; thanks,
谢谢,
Mitch 米奇
I followed this guide which had me add the following lines of code to the bottom of my .htaccess file: 我遵循了该指南 ,使我在.htaccess文件的底部添加了以下代码行:
SetEnvIf Request_URI "(path\to\file\.ext)$" allow Order allow,deny Allow from env=allow Satisfy any
I assume this method requires the icon to be named apple-touch-icon.png
since Safari won't have access to any linking in the HTML. 我认为此方法要求将图标命名为
apple-touch-icon.png
因为Safari无法访问HTML中的任何链接。 Ergo, for my site I specifically used: Ergo,对于我的网站,我专门使用了:
SetEnvIf Request_URI "(apple-touch-icon\.png)$" allow
Where in the root of my website lives a 180px version of my desired icon. 我网站根目录中的180px版本是我想要的图标。
Do not protect the whole site, but all that is in a directory (Even if almost all of the site). 不要保护整个站点,而是保护目录中的所有站点(即使几乎所有站点)。
This way, you can show a home page, with explanations for those wishing to access the site. 这样,您可以显示主页,其中包含希望访问该网站的人员的说明。 And apple-touch-icon...
还有苹果触摸图标...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.