By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

How to link your Sitemap in Robots.txt

Include a link to your sitemap in Robots.txt for automatic discovery by search engines.

Edited: 2012-07-10 06:24

Linking your sitemap in your Robots.txt file can be a useful way to tell search engines where they can find your sites sitemap. To do this you simply need to include another line of code in your robots.txt.

sitemap: /sitemap.xml

If you have multiple sections on your site, you might be wanting to use a sitemap index, in which case you should simply link to the sitemap index – search engines will automatically find the sitemaps listed in your index file. You can read more about these indexes in the XML Sitemap Tutorial.

sitemap: /sitemap-index.xml

Finally there also is nothing wrong with using another extension, such as .php, in case you are automatically generating your sitemaps and/or your index file, just remember to deliver the sitemap with the correct mime-type, which is application/xml.

sitemap: /sitemap-index.php

Last: Block a directory using robots txt