I have problem with rewriting urls on my webpage which is hosted with firebase. This is how my firebase.json looks.
{
"hosting": {
"cleanUrls": true,
"trailingSlash": true,
"headers": [ {
"source": "*.php",
"headers": [ {
"key": "Content-Type",
"value": "text/html"
} ]
} ],
"appAssociation": "AUTO",
"public": "public",
"rewrites": [
{
"source": "**/!(*.css|*.js|*.map|*.jpg|*.gif|*.png|*.php),/post/**",
"dynamicLinks": true
}
]
}
}
So far so good. The problem that I have that's not working. When my webpage is hosted for example on https://google.com
And my inner page for contact are at the moment on https://google.com/contact.php
This is working but that's not working https://google.com/contact But that's what I want. Also maybe you can check If I do it correct with giving 2 rules for rewriting first one is this on
"**/!(*.css|*.js|*.map|*.jpg|*.gif|*.png|*.php)",
Second is this one
/post/**
Can I write it togehter or should I do a own rewrite tag for
/post/**
The closest that Firebase Hosting offers is the "cleanUrls": true
option, which you already set. But that only removes .html
extensions. This is by design, as .html
files are typically served as static content with their full URL showing in the browser.
Firebase Hosting does not interpret PHP code in any way, so most likely it is serving your PHP code as plain text to your site visitors. If there is no PHP code in your files, rename them to .html
at which point the "cleanUrls": true
option will remove the extension.