I created a simple redirect rule in my netlify.toml file:
[[redirects]] from = "/my-url-example" to = "mymobileapp://home" status = 301 force = true
However it’s not redirecting to the app deeplink.
I also tried to do the same thing from the _redirects file.
With deeplink, the 301 isn’t there.
# This doesn't do a 301 redirect, curl just gives me a # 200 OK. /my-url-example mymobileapp://home 301 # This is with the deeplink url rule set. $ curl -sI https://staging.mywebsite.com/my-url-example HTTP/2 200 cache-control: public, max-age=0, must-revalidate content-length: 0 content-type: text/html; charset=UTF-8 date: Fri, 24 Jul 2020 16:19:15 GMT etag: "020b9afec1d77d04f4f68c4b96888384-ssl" strict-transport-security: max-age=31536000 age: 0 server: Netlify x-nf-request-id: b3cdc18b-2fae-4ad8-a77e-677f399672ce-1257749
Removing the deeplink and adding a normal
/ starting string, the 301 is there.
# This does give me a proper 301 redirect. /my-url-example /test-test-test 301 $ curl -sI https://staging.mywebsite.com/my-url-example HTTP/2 301 cache-control: public, max-age=0, must-revalidate content-length: 0 date: Fri, 24 Jul 2020 16:20:40 GMT location: /test-test-test age: 0 server: Netlify x-nf-request-id: 38b149a9-90a8-457c-a3a4-22ca9de1b929-11017228
How can I redirect a URL on my website to my mobile app via deeplink?
It seems in order for netlify to redirect the url must start with a
/. Any workarounds?