regexapache.htaccessmod-rewriteapple-app-site-associate

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


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.


Solution

  • 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]