# /sitemap.xml is returning a 404

**URL:** <https://answers.netlify.com/t/sitemap-xml-is-returning-a-404/108207>\
**Category:** Support\
**Tags:** deployment, redirects\
**Created:** [December 9, 2023, 12:53am UTC](https://answers.netlify.com/t/sitemap-xml-is-returning-a-404/108207 "2023-12-09T00:53:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcantello](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bcantello](https://answers.netlify.com/u/bcantello)\
**Post date:** [December 9, 2023, 12:53am UTC](https://answers.netlify.com/t/sitemap-xml-is-returning-a-404/108207/1 "2023-12-09T00:53:11Z")

</div>

I have deployed my site through netlify and everything seems to be working as expected except for the sitemap. The site is build using Vite.

I have added a sitemap.xml file and a robots.txt file to the root directory. My netlify.toml file in the root directory looks like this:

```auto
[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

[[redirects]]
  from = "/sitemap.xml"
  to = "/sitemap.xml"
  status = 200

[[redirects]]
  from = "/robots.txt"
  to = "/robots.txt"
  status = 200

```

and my \_redirects file looks like this:

```auto
/robots.txt /robots.txt 200
/sitemap.xml /sitemap.xml 200
/* /index.html 200

```

The netlify site is santabarbaramyo. When I test the /sitemap.xml file locally it works as expected. However when I try to access [www.santabarbarmyo.com/sitemap.xml](http://www.santabarbarmyo.com/sitemap.xml) in production after deployment via netlify, I get a 404 not found error.

I have tried using the netlify sitemap plugin, however that only returns the home page since this is a single page react site. I need to be able to use my sitemap.xml file so that all pages are indexed by google. Any help you can provide would be appreciated!

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [December 9, 2023, 6:16pm UTC](https://answers.netlify.com/t/sitemap-xml-is-returning-a-404/108207/2 "2023-12-09T18:16:08Z")

</div>

> [@bcantello](#):
>
> I have added a sitemap.xml file and a robots.txt file to the root directory.

Why not use the `public` directory that Vite provides?

---

<div class="post-metadata">

**Author:** ![bcantello](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bcantello](https://answers.netlify.com/u/bcantello)\
**Post date:** [December 9, 2023, 10:30pm UTC](https://answers.netlify.com/t/sitemap-xml-is-returning-a-404/108207/3 "2023-12-09T22:30:06Z")

</div>

And that fixed it. Thanks!
