skip to Main Content

I have a sitemap.xml file I want to show it when users hit www.mysite.com/sitemap.xml route. How can I do that?
I am using react and react-router-dom.

2

Answers


  1. You can use this method.

    npm i react-router-sitemap

    Login or Signup to reply.
  2. If you already have a sitemap.xml file ready with you, just put it under public directory. Anything under public directory can be directly opened by putting its path after domain url (even if you are using react-router-dom). So, sitemap.xml put under public directory will be available at http://www.mysite.com/sitemap.xml in your case.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search