อนุญาตรูปแบบ URL ที่เฉพาะเจาะจง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการป้องกันไม่ให้บุคคลที่ไม่ได้รับอนุญาตใช้คีย์ API ของคุณเพื่อสร้าง Dynamic Links ที่
เปลี่ยนเส้นทางจากโดเมนของคุณไปยังเว็บไซต์ที่คุณไม่ได้เป็นเจ้าของ คุณควรระบุ URL ที่ Dynamic Links ของคุณเปลี่ยนเส้นทางไปได้
หากต้องการระบุ URL ที่อนุญาต ให้คลิก
more_vert > รูปแบบ URL ในรายการที่อนุญาต
จากหน้าDynamic Linksของคอนโซล Firebase แล้วระบุนิพจน์ทั่วไปได้สูงสุด 10 รายการโดยใช้ไวยากรณ์ RE2 เฉพาะ URL
ที่ตรงกับนิพจน์ทั่วไปเหล่านี้เท่านั้นที่ใช้เป็น Deep Link (link
) หรือลิงก์สำรอง (afl
, ifl
, ipfl
, ofl
) สำหรับ Dynamic Links ได้สำเร็จ หากคุณระบุรูปแบบ URL URL ใดก็ตามที่ไม่ตรงกับรูปแบบใดรูปแบบหนึ่งจะทำให้ Dynamic Links แสดงข้อผิดพลาด HTTP 400
คุณควรกำหนดรูปแบบ URL ให้เข้มงวดที่สุดเท่าที่จะเป็นไปได้ เช่น
อนุญาตมากเกินไป |
ดีขึ้น |
^https://.*.com/.*$
เปลี่ยนเส้นทางไปยังหน้าใดก็ได้ในเว็บไซต์ใดก็ได้ที่ลงท้ายด้วย .com
|
^https://mybrand\.com/.*$
เปลี่ยนเส้นทางได้เฉพาะหน้าเว็บใน mybrand.com
|
^https://play.google.com/.*$
เปลี่ยนเส้นทางไปยังGoogle Play Storeของแอปใดก็ได้
|
^https://play\.google\.com/.*id=myapp\.com$
เปลี่ยนเส้นทางได้เฉพาะหน้าเว็บ Google Play Store สำหรับแอปที่มีชื่อแพ็กเกจ myapp.com
|
^https://itunes.apple.com/.*$
เปลี่ยนเส้นทางไปยังหน้าใดก็ได้ใน itunes.apple.com
|
^https://itunes\.apple\.com/.*id123$
เปลี่ยนเส้นทางได้เฉพาะหน้า App Store สำหรับแอปที่มีรหัส
id123
|
คุณตรวจสอบได้ว่า Deep Link และลิงก์สำรองสำหรับ Dynamic Links ตรงกับรูปแบบ URL รูปแบบใดรูปแบบหนึ่ง
โดยดูหน้าแก้ไขข้อบกพร่องสำหรับ Dynamic Links และยืนยันว่าไม่มีคำเตือน
ดังนี้
https://example.page.link/WXYZ?d=1
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["\u003cbr /\u003e\n\n| **Deprecated:** Firebase Dynamic Links is *deprecated* and should not be adopted in projects that don't already use it. The service will shut down on August 25, 2025. See the [Dynamic Links Deprecation FAQ](/support/dynamic-links-faq) for more information.\n\nTo prevent unauthorized parties from using your API key to create Dynamic Links that\nredirect from your domain to sites you don't own, you should specify the URLs\nyour Dynamic Links can redirect to.\n\nTo specify the allowed URLs, click\nmore_vert **\\\u003e Allowlist URL pattern**\nfrom the Dynamic Links page of the Firebase console, and then specify up to\n10 regular expressions using\n[RE2 syntax](https://github.com/google/re2/wiki/Syntax). Only URLs\nthat match one of these regular expressions can be successfully used as a deep\nlink (`link`) or fallback link (`afl`, `ifl`, `ipfl`, `ofl`) for a Dynamic Links. If\nyou specify URL patterns, any URL that doesn't match one of the patterns will\ncause your Dynamic Links to return HTTP error 400.\n\nYou should make your URL patterns as restrictive as possible. For example:\n\n| Too permissive | Better |\n|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| `^https://.*.com/.*$` Can redirect to any page on any site ending with `.com`. | `^https://mybrand\\.com/.*$` Can redirect only to pages at `mybrand.com`. |\n| `^https://play.google.com/.*$` Can redirect to any app's Google Play Store page. | `^https://play\\.google\\.com/.*id=myapp\\.com$` Can redirect only to Google Play Store pages for the app with the package name `myapp.com`. |\n| `^https://itunes.apple.com/.*$` Can redirect to any page on `itunes.apple.com`. | `^https://itunes\\.apple\\.com/.*id123$` Can redirect only to the App Store page for the app with the ID `id123`. |\n\nYou can make sure a deep link and fallback links for a Dynamic Links match one of\nyour URL patterns by viewing the debug page for Dynamic Links and verifying there are\nno warnings: \n\n```\nhttps://example.page.link/WXYZ?d=1\n```"]]