2

When hosting a static webpage on Firebase using a custom domain - let's say example.com - the page is still also available as examplecomproject.firebaseapp.com.

This is bad, because it generates duplicated content. But I don't find a way to disable hosting unter the *.firebaseapp.com subdomain. The only way seems to be including a correct

<link rel="canonical" href="https://example.com/..." />

in every *.html file. Sadly this is not feasible in my current setup.

Is it possible to configure Firebase to

  • stop responding to the subdomain?
  • to 301 redirect the subdomain to my custom domain?
  • prevent this problem in some other way?

There is another question regarding a similar problem. I opted to raise a new question, since in contrast to the old one, my question is specific for Firebase Hosting and it's about preventing duplicated content.

Chrillewoodz
  • 27,055
  • 21
  • 92
  • 175
jan.vogt
  • 1,801
  • 10
  • 27
  • https://stackoverflow.com/questions/45058710/google-domain-how-to-remove-disable-default-domain-after-adding-custom-domain?rq=1 Frank's response suggests there is no way to do this. Although, maybe you could create a feature request with the firebase team? –  Jan 27 '19 at 16:27
  • "Is it possible to configure Firebase to stop responding to the subdomain?" I answered that in my answer to the question you linked. I recommend removing the question here, since: a) you should limit yourself to one question per post, 2) it makes this question a (partial) duplicate of the one you linked – Frank van Puffelen Jan 27 '19 at 16:28
  • "Is it possible to prevent this problem in some other way?" I avoid the problem by simply not publishing/promoting the `firebaseapp.com` domain anywhere. – Frank van Puffelen Jan 27 '19 at 16:29
  • @FrankvanPuffelen Thanks for the comments. Your second comment could be one answer. I am not convinced deletion is appropriate: a) There is only one question (see title) the grammatical questions in the body are mere options for answers to show my previous research 2)(sic!) I guess questions do overlap sometimes. I tried to discriminate as much as possible: This is about duplicated content. The old question was about one of the many options to solve this. The given workaround there was explicitly excluded as an answer this time. – jan.vogt Jan 27 '19 at 19:00

2 Answers2

0

I usually simply prevent the duplication penalty by never publishing/promoting the http://<myproject>.firebaseapp.com domain. If a search engine doesn't know about the alternate content, it also can't punish my primary domain for the secondary URL.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 2
    Thanks for the answer! Maybe I'll have to settle for this as well. Sadly, we have good reasons to believe that Google is even indexing domains requested via their own DNS servers. So it is virtually impossible to keep these domains secret. If this problem does not occur when using Firebase Hosting, it might actually be due to Google's heuristics for determining the canonical domain. I'm still hoping for an answer that actually gets rid of the duplicated content in the first place... – jan.vogt Jan 27 '19 at 23:42
0

You'll have to include the canonical link in every html file or 'page' in SPA.

Jkarttunen
  • 6,764
  • 4
  • 27
  • 29
  • Thanks for your response. I was looking for an alternative way or a definitive resource (e.g. docs) that say that's the only solution. – jan.vogt May 14 '20 at 11:41