0

I found in the firebase documents that you could hide the .html extensions of my site by creating a "firebase.json" file. I effectively remove the extensions but when I want to enter my other pages I cannot. I always see the main page.

I tried previously with .htaccess but it didn't work out. Now I found this firebase resource but any extension directs me to the main page.

I put that in my file "firebase.json"

"hosting": {

  "cleanUrls": true,
  "trailingSlash": false
}
plum 0
  • 652
  • 9
  • 21

1 Answers1

3

You can set up routes inside of firebase.json. They can either be rewrites (where the url is actually pointing to another location, but that is unknown to the user), or redirects (where the page redirects to another url).

Inside of your firebase.json, hosting should look like this:

"hosting": {
    "public": "public",
    "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
    ],
    "rewrites": [
        {
            "source": "/sign-up",
            "destination": "/sign-up.html"
        }
    ],
    "redirects": [
        {
            "source": "/sign-up.html",
            "destination": "/sign-up"
        }
    ]
}

There are 2 added nodes, rewrites and redirects. What this does is whenever someone visits /sign-up, you actually point them to /sign-up.html, where your actual html code is. But when someone visits /sign-up.html on their own, you redirect them to /sign-up.

Ken Mueller
  • 3,659
  • 3
  • 21
  • 33
  • `"hosting": { "cleanUrls": true, "trailingSlash": false, "public": "public", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "/proyectos", "destination": "/proyectos.html" } ], "redirects": [ { "source": "/proyectos.html", "destination": "/proyectos" } ] }` That is my code of `firebase.json` you can see my page in [link](xmobiliario.com) It was not fixed – Juan Carlos Aug 02 '19 at 20:37
  • Have you tried clearing the cache of your browser? On chrome macOS, press Cmd+y and on the left click "Clear browsing data" and only select clear cache. – Ken Mueller Aug 02 '19 at 21:30