在Netlify网站中从URL重定向到移动应用程序深层链接

时间:2020-07-24 16:03:25

标签: redirect mobile netlify deeplink

我在netlify.toml文件中创建了一个简单的重定向规则:

[[redirects]]
  from = "/my-url-example"
  to = "mymobileapp://home"
  status = 301
  force = true

但是,它没有重定向到应用程序深层链接。

我还尝试通过_redirects文件执行相同的操作。

使用Deeplink,301不存在。

# 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

删除深度链接并添加普通的/起始字符串,则301就在其中。

# 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

如何通过Deeplink将网站上的URL重定向到我的移动应用程序?

为了使netlify重定向URL,必须必须以/开头。有解决方法吗?

0 个答案:

没有答案