如何从更改我的urlhttps://example.com/name.html 到https://example.com/name?

如何从更改我的urlhttps://example.com/name.html 到https://example.com/name?,html,firebase,firebase-hosting,Html,Firebase,Firebase Hosting,如何从https://example.com/name.html至https://example.com/name? 我正在使用Firebase托管来托管我的网站。该网站使用bootstrap studio以HTML和javascript制作 在线阅读各种解决方案后,我知道可以使用“.htaccess”文件来更改url,但没有一种解决方案提供了使用Firebase主机进行更改的方法。Firebase主机有一个名为cleanUrls的设置,用于控制HTML扩展名的存在/不存在。请参阅以下文档: c

如何从
https://example.com/name.html
https://example.com/name
? 我正在使用Firebase托管来托管我的网站。该网站使用bootstrap studio以HTML和javascript制作


在线阅读各种解决方案后,我知道可以使用“.htaccess”文件来更改url,但没有一种解决方案提供了使用Firebase主机进行更改的方法。

Firebase主机有一个名为
cleanUrls
的设置,用于控制HTML扩展名的存在/不存在。请参阅以下文档:

cleanUrls
属性允许您控制URL是否应包含
.html
扩展名

如果为true,则宿主会自动从上载的文件URL中删除
.html
扩展名。如果在请求中添加了
.html
扩展名,宿主将执行
301
重定向到同一路径,但会删除
.html
扩展名

通过在您的
firebase.json
文件的宿主中包含cleanUrls属性,指定包含
.html
扩展名。例如:

“更改url”是什么意思?如果您只希望/name.html中的文件也出现在/name中,那么您可能可以使用。
"hosting": {
   // ...

   // Add the "cleanUrls" attribute within "hosting"
   "cleanUrls": true
}