See apple-app-site-association file in .well-known directory despite RewriteCond

早过忘川 提交于 2021-02-11 12:33:55

问题


In my sites hosted on Dreamhost, the .well-known directory contains an acme-challenge folder along with an .htaccess like this:

# Permit access to the challenge files but nothing else
Order allow,deny
Allow from all

RewriteCond %{REQUEST_URI} ^/[.]well-known/acme-challenge/[a-zA-Z0-9_-]+$
RewriteRule .* - [L]

RewriteRule .* - [F]

Therefore when I put my apple-app-site-association file into .well-known, it isn't seen. How would I modify the .htaccess to permit this? Would I just stick in another line such as

RewriteCond %{REQUEST_URI} /.well-known/apple-app-site-association

?? I don't want to break anything and I know virtually nothing of the syntax in these files, so I'm being rather hesitant.


回答1:


Change your first rule like this with an OR condition:

RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/[\w-]+/?$ [OR,NC]
RewriteCond %{REQUEST_URI} ^/\.well-known/apple-app-site-association/?$ [NC]
RewriteRule ^ - [L]

Or it can be combined in a single condition also:

RewriteCond %{REQUEST_URI} ^/\.well-known/(?:acme-challenge/[\w-]+|apple-app-site-association)/?$ [NC]
RewriteRule ^ - [L]


来源:https://stackoverflow.com/questions/63456352/see-apple-app-site-association-file-in-well-known-directory-despite-rewritecond

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!