0

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.

anubhava
  • 761,203
  • 64
  • 569
  • 643
matt
  • 515,959
  • 87
  • 875
  • 1,141

1 Answers1

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]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • 1
    Thanks, I'll give it a try immediately. (I'm sure that answer is obvious to you but it would never have occurred to me in a million years.) – matt Aug 17 '20 at 18:17
  • 1
    (It occurs to me that I should explain, in case anyone comes along and sees this, what "working" means. (1) `https://` links into my web site still work. So we are still seeing the certificates, which is what the `acme-challenge` stuff was all about. (2) I was able to configure a test iOS app and the `apple-app-site-association` file, living in the `.well-known` directory, such that an `https://` link of a certain form is routed to my app — in other words, universal links are working.) – matt Aug 17 '20 at 18:46