Search code examples
reactjsxmlfirebasesitemapfirebase-hosting

How to store xml file on firebase hosting get url point to it?


I have a React app that is stored in google Firebase with my custom domain (not the one that is provided by google Firebase) I have created an xml file and want to store it on google Firebase and get its URL.

for example if my website domain is: www.mywebsite.com I want to upload file sitemap.xml to Firebase and get it stored there, and to be able to access it through: www.mywebsite.com/sitemap.xml

How can I upload that file and have access to it through that URL?


Solution

  • If you want to upload a sitemap.xml:

    1. Place the sitemap.xml into the folder that you've configured as the public folder in your firebase.json, which is also the folder where you have your main index.html file.
    2. Run firebase deploy --only hosting.

    Now the sitemap.xml will be available on www.mywebsite.com/sitemap.xml.