Choose a plan

Sitemap.xml and robots.txt: what they are and how to check them

What the sitemap does and what robots.txt does, where to find them in WordPress, what correct ones look like and mistakes that drop a site from Google.

  • Updated
guide · seo
Steps
10
Reading time
4min
Sections
4
Start the guide

Two small files in the website's root talk to search engine robots. sitemap.xml is the list of pages you want them to find. robots.txt tells them where they're not allowed to go. The first one helps; the second one, written wrong, can take your whole website out of Google without you noticing.

What you'll achieve

  • find your website's sitemap and submit it to Google;
  • check that robots.txt doesn't block what it shouldn't;
  • tell Disallow apart from noindex and know when to use each.

What they are, in short

The fileWhat it doesWhat it does NOT do
sitemap.xmllists the page addresses, with the date of the last change, so Google finds them fasterdoesn't guarantee that the pages get into Google
robots.txttells robots which folders or pages not to readdoesn't hide pages: a blocked page can still appear in results, without a description
the noindex tagsays the page should not appear in resultsdoesn't work if robots.txt blocks the page: Google no longer reads it, so it doesn't see the tag

The steps

A. Find the sitemap

  1. WordPress: open https://domeniul-tau.ro/wp-sitemap.xml. WordPress creates it on its own. If you have an SEO plugin, it may replace it with its own, usually at sitemap_index.xml or sitemap.xml; the exact address is in the plugin's settings.
  2. Hand-built website: usually https://domeniul-tau.ro/sitemap.xml, if whoever built the website added one. If it doesn't exist, they can generate it, or you can write it yourself, following the example below.
  3. You should see a list of addresses. Check that they are the real addresses, on https:// and in the version you chose, with or without www (see Redirect to HTTPS and www).

A minimal sitemap for a small website:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>https://domeniul-tau.ro/</loc></url>
  <url><loc>https://domeniul-tau.ro/servicii</loc></url>
  <url><loc>https://domeniul-tau.ro/contact</loc></url>
</urlset>

Upload it to public_html from Enhance, the “Files” tab (see Uploading a website with File Manager).

B. Check robots.txt

  1. Open https://domeniul-tau.ro/robots.txt.
  2. A good robots.txt for an ordinary website:

    User-agent: *
    Disallow:
    
    Sitemap: https://domeniul-tau.ro/sitemap.xml

    An empty Disallow: means “nothing is off limits”. In WordPress, the file generated by WordPress only blocks /wp-admin/, which is correct.

  3. The red flag: Disallow: /, with a slash. It means “don't read anything on the website”. It's set on websites under construction and gets forgotten there at launch.
  4. In WordPress, also check Settings » Reading: the Discourage search engines from indexing this site box must be unchecked on a live website.

C. Hide a page from results, the right way

  1. For a page that shouldn't appear in Google (a thank-you page, a test page), use the noindex tag in the page, not robots.txt:

    <meta name="robots" content="noindex">

    In WordPress, SEO plugins have an option for this on every page.

  2. For private areas (a dashboard, documents for customers), neither robots.txt nor noindex is protection: set a password.

D. Submit the sitemap to Google

  1. In Search Console, under Sitemaps, add the sitemap's address (see Google Search Console: connect your website to Google).

If something doesn't work

  • wp-sitemap.xml returns 404. An SEO plugin has replaced it with its own (look for the address in the plugin's settings), or the permalinks aren't saved: in WordPress, go to Settings » Permalinks and click Save Changes without changing anything.
  • Search Console says “Blocked by robots.txt”. The page is covered by a Disallow rule. Remove the rule if the page should appear in Google.
  • Search Console says “Excluded by ‘noindex’ tag”. The page has noindex. If you didn't add it, check the indexing setting in WordPress and the SEO plugin.
  • The sitemap contains addresses with http:// or a different www version. Correct the website address in WordPress, under Settings » General, and the SEO plugin's settings.
Support

Stuck? We'll do it together.

Tell us which step isn't working and, if you can, send a screenshot. We reply during business hours.

Phone and WhatsApp+40 775 396 021
HoursMonday–Friday, 9:00–18:00 Romanian time (EET/EEST)

Never send us your password on WhatsApp or by email. What information helps us solve it on the first try: how to ask for help.