An XML sitemap is a list of the pages on your website, written in a format search engines read. It is one of the simplest SEO tasks there is, takes minutes to set up, and is especially useful when your site is new, large, or has pages that aren't well linked internally.
In this guide you will learn what a sitemap does and doesn't do, how to find the one WordPress already generates, how to write one by hand, which URLs belong in it, and how to submit it to Google and read the result. At the end there's a troubleshooting section for the errors people hit most.
What a sitemap does, and what it doesn't
A sitemap tells search engines: "these are the URLs I'd like you to know about, and this is when they last changed." Google uses that to discover pages faster and to decide when to recrawl them.
It is just as important to know its limits. A sitemap:
- does not guarantee indexing. Google still decides which pages are worth storing; see How to get your website indexed by Google.
- does not improve rankings. It helps discovery, not position.
- does not replace internal links. Pages that are only in the sitemap and linked from nowhere look unimportant.
- does not block anything. To keep a page out of Google, use
noindexor password protection, not omission from the sitemap.
Find the sitemap WordPress already makes
Since version 5.5, WordPress generates a sitemap automatically. Open this in your browser:
https://example.com/wp-sitemap.xml
It is a sitemap index that links to separate sitemaps for posts, pages, categories, tags and authors. Each sub-sitemap holds up to 2,000 URLs before WordPress splits it.
SEO plugins such as Yoast SEO and Rank Math switch off the built-in sitemap and serve their own, usually at:
https://example.com/sitemap_index.xml
Tip: Run only one sitemap solution. Two plugins generating sitemaps, or a plugin plus a hand-made file, leads to confusing duplicates in Search Console.
If neither address works, check Settings → Reading. When "Discourage search engines from indexing this site" is ticked, WordPress disables its built-in sitemap.
Write a sitemap by hand
For a static site or a small custom-built one, a hand-written file is perfectly fine. Create a file called sitemap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-11-20</lastmod>
</url>
<url>
<loc>https://www.example.com/services/</loc>
<lastmod>2026-10-02</lastmod>
</url>
<url>
<loc>https://www.example.com/contact/</loc>
</url>
</urlset>
Rules to follow:
- Save the file as UTF-8.
- Use absolute URLs with the protocol and the exact hostname your site uses (
https://www.orhttps://, not a mix). <loc>is the only required tag.<lastmod>is useful, but only if it reflects real content changes; Google learns to ignore dates that change on every build. Google ignores<priority>and<changefreq>, so you can leave them out.- Escape special characters:
&becomes&. Non-ASCII characters in paths should be percent-encoded.
Upload the file to your site's document root, which on cPanel hosting is public_html. The File Manager is the easiest way; see How to upload files to your website with File Manager. Then open https://www.example.com/sitemap.xml in a browser to confirm it loads.
You can also validate it from the command line:
curl -sI https://www.example.com/sitemap.xml | head -5
curl -s https://www.example.com/sitemap.xml | xmllint --noout - && echo "valid XML"
The first command should show HTTP/2 200 (or HTTP/1.1 200 OK) and an XML content type.
Large sites: limits and sitemap index files
A single sitemap can hold at most 50,000 URLs and be at most 50 MB uncompressed. Larger sites split their URLs over several files and list those in a sitemap index:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap-pages.xml</loc>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-products.xml</loc>
</sitemap>
</sitemapindex>
You then submit just the index. Splitting by content type also makes it easier to see in Search Console which section has indexing problems.
Which URLs belong in your sitemap
Include only pages you actually want in Google. Each URL should be:
- the canonical version (not a duplicate or parameter variant),
- indexable (no
noindex, not blocked by robots.txt), - answering with HTTP 200 (not a redirect or a 404).
Leave out:
- login, account, cart and checkout pages,
- internal search results,
- thin tag or archive pages,
- test and staging pages,
- URLs with tracking parameters such as
?utm_source=, - WordPress attachment pages.
Add the sitemap to robots.txt
Add a Sitemap: line with the full URL to your robots.txt, so every crawler can find it, not only Google:
User-agent: *
Disallow:
Sitemap: https://www.example.com/sitemap.xml
WordPress adds this line to its virtual robots.txt automatically. If you have a physical robots.txt file in public_html, you need to add it yourself. Our robots.txt guide covers the rest of the file.
Submit the sitemap in Google Search Console
- Open Google Search Console and select your property.
- Go to Indexing → Sitemaps.
- Under "Add a new sitemap", enter the path, for example
sitemap.xmlorwp-sitemap.xml, and click Submit. - Check the "Submitted sitemaps" table. It shows the status, when Google last read the file and how many URLs it discovered.
The status column tells you what happened:
| Status | Meaning |
|---|---|
| Success | Google read the file without errors. Not every URL in it is necessarily indexed. |
| Has errors | Google read the file, but some entries are invalid, for example malformed XML or URLs on another domain. |
| Couldn't fetch | Google couldn't download the file at all. |
Click a sitemap and choose See page indexing to see which of its URLs are indexed and why the others aren't.
Common problems and fixes
- The sitemap returns 404. Check the filename, the WordPress visibility setting, and whether your SEO plugin's sitemap is enabled. In WordPress, re-saving Settings → Permalinks often fixes a 404 on the sitemap.
- Couldn't fetch. The file is blocked by robots.txt, the server returns an error, or a firewall or CDN rule blocks Googlebot. Don't whitelist bots by user agent alone; Google publishes how to verify Googlebot with a reverse DNS lookup.
- Submitted URL marked noindex. A page in the sitemap tells Google not to index it. Decide which you want: remove the noindex or remove the page from the sitemap.
- Old content in the sitemap. A caching plugin or CDN is serving a stale copy. Exclude the sitemap from the cache or purge it.
- Wrong domain or http URLs. After a move or switch to HTTPS, the WordPress Address and Site Address under Settings → General still hold the old values.
In short
An XML sitemap lists the canonical, indexable pages you want Google to find. WordPress makes one for you; otherwise a hand-written sitemap.xml in your document root works fine. Keep it clean, add it to robots.txt, submit it once in Search Console, and use the status and page indexing reports to catch problems.
Hosting your site at Hostigan
Hostigan's cPanel web hosting and WordPress hosting give you File Manager access to your document root and one-click WordPress installs, so publishing a sitemap takes minutes. Compare our web hosting plans or WordPress hosting.
Frequently asked questions
No. A sitemap helps Google discover and recrawl your pages, but it has no direct effect on where they rank.