Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Does it make any difference to SEO ratings what-so-ever if your url has a trailing slash:

http://www.example.com/some/slug/paths/

as opposed to one that does not:

http://www.example.com/some/slug/paths
share|improve this question

2 Answers 2

up vote 26 down vote accepted

Read the full blog post by Google here, http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html, it covers this exact topic.

Long story short Google does not care if you have a trailing slash. However, it will treat the below 2 paths as separate pages.

http://www.example.com/some/slug/paths/
http://www.example.com/some/slug/paths

If you need to have both of the above and they are the same content your best option is to do a 301 Redirect to one of them from the other.

If that isn't an option you will want to add a <link rel="canonical" href="your link"/> to both pages which will define which one is the master or parent. Matt Cutts has a great article here, http://www.mattcutts.com/blog/canonical-link-tag/, that covers the topic in its entirety.

share|improve this answer
    
That is good practice anyway, because you never know what people will put as the URL when linking to you. I'd hate to get a permanent link on a PR8 site that was not to my canonical URL :) –  Tim Post Aug 24 '10 at 13:52
2  
This is not really what the canonical tag is for. The correct thing to do is to 301 redirect the slash version to the non-slash version (or vice versa, depending on which you want), which is exactly what the Google webmaster central blog entry you linked suggests. Use a canonical here only if a 301 is not possible. –  Tim Fountain Aug 24 '10 at 14:46
    
@Tim - Good point. You are right, the canonical is only the backup choice. I modified my answer to be more correct. Thanks! –  RandomBen Aug 24 '10 at 14:55
1  
Server side applications also treat the paths differently. In Django, domain.com/some will be redirected to domain.com/some/. Something to keep in mind. :) –  citadelgrad Aug 24 '10 at 15:04

In addition to RandomBen's point about search engines treating URLs with a trailing slash versus without as two different URLs, I'd like to add this. I generally use the trailing slash to indicate a category, while I don't use a trailing slash for pages that are at the end or bottom of a hierarchy. Slash your categories, don't slash anything else. If you're rewriting URLs, this most closely matches the natural file structure. However, you should make sure that each category in your path exists, or you could end up with some confused and frustrated users. In your example URL, "some" and "slug" should both be accessible pages.

share|improve this answer
    
That can be quite reasonable. If you want to emulate a file system in your URLs, would it then perhaps be neater to 'go all the way', and give your stub pages a (possibly fake) extension, like .html or .py, .pl, .asp, or something else. Just having no trailing slash does not communicate "stub page" to me, it could just have been forgotten -- but a "file" extension does. –  Jesper Mortensen Sep 4 '10 at 21:51
    
@Jesper "Who says a file name needs an extension?? take a look on a *nix machine sometime" -stackoverflow.com/questions/5948659/… –  Yarin Oct 31 '11 at 23:03

Your Answer

 
discard

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.