Erik
Erik

Reputation: 2530

>= 400 error code with apple-app-site-association json file

As many others I am trying to implement universal links into my app.

I am using one.com as my webhotel provider, and have configured an apple-app-site-association json file without the json file ending.

Initially, I had troubles with strange characters appearing and the infamous content/type fault. I added this snippet to my .htaccess file as follows that solved that issue:

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

Below is the entire .htaccess code:

# Generated by One.com Website Builder
# Begin

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

RewriteEngine on

# Enforce SSL
# Handle non-www URLs
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^studievenn\.no [NC]
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Handle www URLs
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.studievenn\.no [NC]
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Handle URLs without .html extension
RewriteCond %{REQUEST_METHOD} ^(GET) [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.html -f
RewriteRule ^(.*) $1.html [L]

# End
# Generated by One.com Website Builder

Here is the aasa validator response

enter image description here

I am primarily struggling with the

Your server returned an error status code (>= 400)

Fault, but also the two latters errors.

What could be the issue here?

Upvotes: 2

Views: 2410

Answers (2)

Erdem KO&#199;HAN
Erdem KO&#199;HAN

Reputation: 11

you should add this end of the htaccess file it worked form me

Header set Content-type "application/pkcs7-mime"

Upvotes: 0

Erik
Erik

Reputation: 2530

I solved this problem by rather placing the apple-app-site-association file in a subdirectory: /.well-known/apple-app-site-association instead of my document root. This fixed the issue.

Upvotes: 3

Related Questions