-1

I want to craft a path for Universal Link that are only valid when there's 1 folder segment. Like:

https://example.com/first or https://example.com/first/

but I don't want it to come into my app when the URL is:

https://example.com/first/second
https://example.com/first/index.html
https://example.com/first/second/script.js
https://example.com/first/second/third/image.png

I am using this AASA JSON

"appID": "<appid>",
"paths": [ 
  "*/*.aspx",
  "NOT /first/*/*",
  "/first/*/"
]

It doesn't work. How can I control this by number of path segment?

Kenny Lim
  • 1,193
  • 1
  • 11
  • 31

1 Answers1

0

The issue with the * is that you will include any string combination including the empty string. I would suggest trying to add a ? character followed by a * to ensure that the string cannot be empty. In your case, try:

"appID": "<appid>",
"paths": [ 
   "*/*.aspx",
   "/?*", //Include paths that have '/first/'
   "NOT /?*/?*" //For paths that have '/first/second/third' etc
]

Hopefully, that works for you.

clayjones94
  • 2,648
  • 17
  • 26