Reputation: 31
is it possible to set a path in the "paths" array inside the apple-app-site-association file that will open only the original domain in the application?
for example, if my domain is https://www.example.com
i want the app to be opened if a user clicks a link to https://www.example.com
but not to https://www.example.com/a
Upvotes: 1
Views: 843
Reputation: 6032
I didn't test solutions below, so I can't guarantee that they will work. At the same time they all are based on documentation, so they should. I currently don't want to invest time into setting up test environment for this, so that would be nice if you share your test results.
My first suggestion would be just this:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "%YOUR.APP.ID%",
"paths": [
"/"
]
}
]
}
}
If this didn't help, here's another go:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "%YOUR.APP.ID%",
"paths": [
"NOT /?*",
"/*"
]
}
]
}
}
Here ?
matches any single character, and *
matches any substring, including empty. The idea in the second case is that the system might use the rules from top to bottom.
Because the system evaluates each path in the paths array in the order it is specified—and stops evaluating when a positive or negative match is found—you should specify high priority paths before low priority paths. https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html?utm_source=revxblog
The third idea would be to at first exclude all the top level components you know then adding allow all. That might be really overwhelming, especially if you don't control paths or they change.
Upvotes: 0