cbdeveloper
cbdeveloper

Reputation: 31335

How to configure Firebase Hosting to serve my app from my custom domain with and without the "www" subdomain?

I want my website to be accessible from: www.myexamplewebsite.pt AND myexample.pt. With and without the www part.

Right now only www.myexamplewebsite.pt is working.

When I try to access myexamplewebsite.pt (without www) this happens:

enter image description here


enter image description here


Note: Since I'm getting a page not found from Firebase (as mentioned above), I guess that there's nothing wrong with my DNS settings.

enter image description here


QUESTION

How can my web app be accessible from both URLs (with and without the www) ?

The only piece of Firebase Hosting doc that I found that mentions this, didn't help me very much:

https://firebase.google.com/docs/hosting/custom-domain#set-up

enter image description here

UPDATE: Here is my DNS config:

enter image description here

Upvotes: 0

Views: 542

Answers (2)

cbdeveloper
cbdeveloper

Reputation: 31335

Now it's working.

1 - I've added my 1st custom domain. I think I've entered it without the www (almost sure)

2 - Somehow, after it's been connected (detected the DNS records), it was displayed on Firebase Hosting with the www (it's the last one in the second picture below)

3 - Then I've added a new custom domain. Again, this time for sure I've entered it without www and marked to redirect to my domain with the www

Result: Not my app is accessible with and without the www


DNS Config

enter image description here

Firebase Hosting Domains:

enter image description here

Upvotes: 0

Renaud Tarnec
Renaud Tarnec

Reputation: 83048

In my experience, creating the DNS A records for both the domains (i.e. www.myexamplewebsite.pt and myexamplewebsite.pt in your case) does the trick. See https://firebase.google.com/docs/hosting/custom-domain#go-live for the doc on DNS A records creation.

Upvotes: 1

Related Questions