本文介绍了尽管 RewriteCond,请参阅 .well-known 目录中的 apple-app-site-association 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我托管在 Dreamhost 上的站点中,.well-known 目录包含一个 acme-challenge 文件夹以及一个像这样的 .htaccess:

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]

因此,当我将我的 apple-app-site-association 文件放入 .well-known 时,它没有被看到.我将如何修改 .htaccess 以允许这样做?我是否会坚持另一行,例如

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.

推荐答案

像这样用 OR 条件改变你的第一条规则:

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]

这篇关于尽管 RewriteCond,请参阅 .well-known 目录中的 apple-app-site-association 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 01:03