I have my website setup correctly via Firebase hosting and have connected multiple domains to it: https://domain1.com, https://domain2.com and https://domain3.com
For SEO, each domain should best have a robots.txt and a sitemap.xml reference in it.
User-agent: *
disallow:
sitemap: https://domain1 or domain2 or domain3/sitemap.xml
The sitemap url in the robots.txt should be a full URL (not relative) and I can only specify one. So I created on the root of my projects different domain1_robots.txt, domain2_robots.txt
I read Firebase documentation about rewrite rules and glob patterns:
https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching
But these patterns do not seam to check on the host name? So how to create a rewrite rules like this?:
- https://domain1.com/robots.txt -> /domain1_robots.txt
- https://domain2.com/robots.txt -> /domain2_robots.txt
- https://domain3.com/robots.txt -> /domain3_robots.txt
So that I can correctly serve the right robots.txt for each domain?
This would be possible by using a cloud function and some js code, but I do not want to invoke a cloud function for each crawler... (costs)