I'm using Firebase Dynamic Links to redirect users to mobile app.
Links like https://example.com/mypath works, but I also want to use root url, i.e. https://example.com
Currently it shows error:
Invalid Dynamic Link
Requested URL (https://example.com/) must be a parsable and complete DynamicLink.
If you are the developer of this app, ensure that your Dynamic Links domain is correctly configured and that the path component of this URL is valid.
When I try to set up a link without prefix, it shows error:
Short URL is required

Is it any way to set up root url?
Another way to set up a redirect from the root dynamic link domain (without serving a page with a javascript redirect) is by adding a redirect rule like this one to your firebase.json file:
"redirects": [ {
"source": "/",
"destination": "https://example.com/page-for-root-to-redirect-to",
"type": 301
} ]
This rule will exist alongside your dynamic link rewrite rule(s), so for a simple setup where all paths except the root are treated as dynamic links, your firebase.json might look like this:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "/**",
"dynamicLinks": true
} ],
"redirects": [ {
"source": "/",
"destination": "https://example.com/page-for-root-to-redirect-to",
"type": 301
} ]
}
}
To access and modify your firebase.json file, you'll have to set up firebase hosting with the Firebase CLI if you haven't already: https://firebase.google.com/docs/hosting
This page explains more about the firebase.json file and how to use rewrite and redirect rules: https://firebase.google.com/docs/hosting/full-config
If you also happen to use Cloudflare, my solution to this problem was to add a subdomain to Firebase dynamic links and make the main url redirect to the subdomain using page rules.
This way, you can setup it up to work like this:
example.com/url -redirect_to-> subdomain.example.com/url (and load dynamic link)example.com/ -redirect_to-> main site or whatever you wantIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With