0

In my website i.e in my server i have googlee.technology/Verify/191711443.pdf is there, I want to know if user enters googlee.technology/Verify/191711443 without pdf extension, I want to display same results in my web page . How to do that. This is my Firebase.json file code:

{ 
  "hosting": {
    "site": "chinnapareddy",
    "public": "y",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  },
  `"functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ],
    "source": "functions"`
  }
}

1 Answer 1

2

To rewrite /Verify/191711443 to /Verify/191711443.pdf, you'd use this in your firebase.json:

"hosting": {
  // ...

  // Add the "rewrites" attribute within "hosting"
  "rewrites": [ {
    "source": "/Verify/191711443",
    "destination": "/Verify/191711443.pdf"
  }]
}

Update: this is what the JSON from your last comment should look like:

{
    "hosting": {
        "site": "chinnapareddy",
        "public": "y",
        "ignore": ["firebase.json", "/.*", "**/node_modules/"]

        "rewrites": [{
            "source": "/Verify/191711443",
            "destination": "/Verify/191711443.pdf"
        }]

    },

    "functions": {
        "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run lint"],
        "source": "functions"
    }

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

9 Comments

I am getting error when deploying code { "hosting": { "site": "chinnapareddy", "public": "y", "ignore": [ "firebase.json", "/.*", "**/node_modules/" ] "rewrites": [ { "source": "/Verify/191711443", "destination": "/Verify/191711443.pdf" }] }, "functions": { "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint" ], "source": "functions" } }
Pls provide me full working code and I added in above
Not working, it says 404 file not found............... This is code................{ "hosting": { "site": "chinnapareddy", "public": "y", "ignore": [ "firebase.json", "/.*", "**/node_modules/" ] }, "functions": { "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint" ], "source": "functions", "rewrites": [ { "source": "/Verify/191711443", "destination": "/Verify/191711443.pdf" }] } }
You've put the rewrites inside functions. As the comment says, it's supposed to go straight inside hosting. I updated my answer to show with the rest of your file.
Updated. But honestly, at this point I'm just parsing this doc sample for you: firebase.google.com/docs/hosting/…
|

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.