Netlify fbclid 重定向 [英] Netlify fbclid redirects

查看:67
本文介绍了Netlify fbclid 重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否帮我了解 Facebook 添加到网址的新 fbclid 字段的 netlify 重定向规则?这对分析和缓存来说很糟糕.我尝试过的:

Can you please help me with the netlify redirect rules for the new fbclid field that Facebook adds to urls? It is terrible for analytics and cache. What I have tried:

/mysite.test/*fbclid /mysite.test/:splat 301

推荐答案

Netlify 上的重定向具有特定规则,在您对其进行测试之前,这些规则并不总是那么清晰.

Redirects on Netlify have specific rules that aren't always as clear until you test them.

https://example.com?id=23&fbclid=huihd8239732buibiee32809jeee2i90

你需要一个没有任何通配符和 :splat

You will need a redirect without any wildcard and :splat

/ id=:id fbclid=:fbclid / 301

重定向到:https://example.com

https://example.com/test?id=23&fbclid=huihd8239732buibiee32809jeee2i90

需要使用通配符和 :splat 进行重定向

A redirect with the wildcard and :splat would be needed

/* id=:id fbclid=:fbclid /:splat 301!

重定向到:https://example.com/test

_redirects

/ id=:id fbclid=:fbclid / 301
/* id=:id fbclid=:fbclid /:splat 301!

注意:所有参数必须匹配才能捕获重定向情况.在上面的示例中,如果只有一个 fbclid 参数,那么您应该使用以下内容来捕获它.

Note: ALL parameters must match to catch the redirect case. In the example above, if there was only an fbclid parameter then you should have the following to catch it.

_redirects

/ fbclid=:fbclid / 301
/ id=:id fbclid=:fbclid / 301
/* fbclid=:fbclid /:splat 301!
/* id=:id fbclid=:fbclid /:splat 301!

警告: 请勿设置类似于以下示例的重定向.它们将导致无限重定向:

Warning: DO NOT setup a redirects similar to the below examples. They will cause an infinite redirect:

不要尝试重定向到相同的路径以去除或添加尾随 /.使用管理面板并更改漂亮的 URL 设置(构建和部署 > 后期处理 > 资产优化).

Do not try to redirect to the same paths to strip or add a trailing /. Use the admin panel and change the pretty URL settings (Build & deploy > Post processing > Asset optimization).

# Do Not ever do these in your redirects
/some-path /some-path/ 301!
/*   /:splat/  301!

这篇关于Netlify fbclid 重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆