0

I'm using firebase hosting. I have index.html file.

It's opening via Both Firebase URL and Custom Domain.

If anyone tries open example.com it should open index.html

But if anyone try to open example.com/?link=https://google.com it should dynamically open the URL in link parameter.

I don't know what I'm doing wrong. Even if the link parameter is present. It still opens the index.html file.

Here is my firebase.json

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
"appAssociation": "AUTO",
"rewrites": [
  {
    "source": "/?link**",
    "dynamicLinks": true
  },
  {
    "source": "!/?link**",
    "destination": "/index.html"
  }
]
  }
}

1 Answer 1

1

You should remove the rewrite rule for index.html

{
  "source": "!/?link**",
  "destination": "/index.html"
}

and remove ? on the dynamicLinks rewrite rule source. It should look like this.

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "appAssociation": "AUTO",
    "rewrites": [{
      "source": "/link**",
      "dynamicLinks": true
    }]
  }
}

Deploy the changes again and this should set https://example.com/link as your Dynamic Link domain. You can test if the FDL domain functional by manually adding FDL parameters on the domain.

i.e. https://example.com/link?link=https://google.com

Sign up to request clarification or add additional context in comments.

4 Comments

I removed this, Still it's not redirecting the dynamic links.
Thanks. It looks like I missed the ? set on the dynamicLinks source. That should also be removed.
Thank Omatt. How many Redirection can I make like this? Is it unlimited or what?
Same for me, redirection still does not work in 2023. Documentation on this is horrible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.