如何在Firebase托管中关闭默认域-Firebase [英] How to turn off default domain in firebase hosting - firebase

查看:70
本文介绍了如何在Firebase托管中关闭默认域-Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚设置了新的Firebase托管以及我的自定义域和我的网页等...

I just set up new Firebase Hosting and my custom domain and my web page, etc...

一切正常,但真正困扰我的是默认域:

Everything works great, except what is really bothering me are default Domains:

  • projectname.web.app
  • projectname.firebaseapp.com
  • projectname.web.app
  • projectname.firebaseapp.com

环顾谷歌搜索功能,我没有找到解决方案,如何删除或禁用它们...有什么建议吗?这似乎很烦人.对我来说,这可能是个表演的终结者...

Looking around googling, I have not found a solution, how to remove or disable them... Any suggestion? This seems really annoying. It could be a show stopper for me...

推荐答案

我已经联系了Firebase Hosting帮助. 根据它们,您不能禁用,删除,隐藏或将其设置为私有.意味着它们将永远存在,并可供公众使用...

I have contacted Firebase Hosting help. According to them, you can not disable, remove, hide or make them private. Meaning they will always be there and be accessible to the public...

他们的官方答复;

  • 您可以做的是添加标题(由Firebase Hosting建议):

<link rel="canonical" href="http://myapp.domain.com/" />

但是,这对我来说开箱即用.我要求Google重新索引我的网页(此时仍在等待重新索引).

However, this did not work for me out of the box. I asked Google to re-index my web page (still waiting at this point to re-index).

  • 另一种方法(Firebase Hosting也建议),重定向:

//check if the url if (window.location.hostname == "yourapp.web.app" || window.location.hostname == "yourapp.firebaseapp.com") { window.location.href = 'http://yourcustomdomain'; }

//check if the url if (window.location.hostname == "yourapp.web.app" || window.location.hostname == "yourapp.firebaseapp.com") { window.location.href = 'http://yourcustomdomain'; }

这篇关于如何在Firebase托管中关闭默认域-Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆