Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At the following page:


the urls given in the Sitemap example don't have a forward slash at the end.

But i think i heard somewhere that they should.

In my Sitemap file, should I include a forward slash/ on the end of each url?

Or does it not matter?

share|improve this question
up vote 4 down vote accepted

The URLs you use in your Sitemap should be the same canonical URLs you use on your site. They should only have a forward slash at the end if your page is the default document within the directory eg. index.html, index.php, etc. But this should also be how you link to the page within your site. The forward slash is simply to avoid any ambiguity, to indicate it is a directory and not a file.

For example, you should not link to the default document in the directory:


You should simply show the URL as (with a trailing slash):


As mentioned, the trailing slash removes any ambiguity. If you omit the trailing slash, it will probably still work, but it first looks for a file called to before realising it's a directory.

The URLs in the sitemap example at the address given do not have a forward slash at the end because they are linking to specific files.

Incidentally, this relates more to how you link to files within your site - not just the Sitemap.

share|improve this answer
thanks w3d -- so on my site, if I don't add a slash or index.php, it goes to my homepage -- does this mean i dont add the slash? the site is wordfruit.com – Richard Sep 10 '11 at 20:27
I think you should include the trailing slash in the sitemap URL. You do seem to be linking to "/" in your home links, so you are actually linking to http://wordfruit.com/. The browser seems to treat site-root links a bit different anyway, in that it appears to automatically append the trailing slash when a user types somedomain.com in their browser. However, sub pages do seem to be different. – w3dk Sep 11 '11 at 0:08
...Sub pages cont... for example, you link to http://wordfruit.com/copywriters, which implies a file called 'copywriters', but the actual page returned by the server is http://wordfruit.com/copywriters/index.php. The server has had to do some extra processing in order to work this out since there is no file called 'copywriters'. Ideally you should include http://wordfruit.com/copywriters/ in your sitemap (and in your site link). – w3dk Sep 11 '11 at 0:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.