Universal Links and Apple’s Cruelty

You may be interested in using Apple’s Universal Links. It is not too complicated, with one possible exception. Apple insists on the following:

  • You need a file named apple-app-site-association
  • The file name cannot have an extension
  • The file must be of type application/json
  • The file must reside in one of two directories that are likely to have other files of other types

The difficulty is in assigning a type of application/json to a single file without an extension. Here is the solution for .htaccess (thanks to my elder son!) for those hosting the file on an Apache server:

<Files apple-app-site-association>
ForceType application/json
</Files>

2 thoughts on “Universal Links and Apple’s Cruelty”

  1. Amar Kumar

    Hey, I’m struggling with this. After updating the .htaccess file, can you tell me at what location do I put the actual file?

    I tried putting it to parallel to .htaccess or in wp-content folder. However, it didn’t work for me both ways.

    Reply ↓
  2. Mark Durham

    My apologies for taking two years to post and answer this question, and for not spelling it out explicitly in the first place. The apple-app-site-association file, used for Universal Links on iOS, should be hosted at the root of your HTTPS web server or in the .well-known subdirectory. Specifically, it should be accessible via HTTPS without redirects at https:///apple-app-site-association or https:///.well-known/apple-app-site-association.

    Reply ↓

Leave a Reply

Your email address will not be published. Required fields are marked *