Link Building

Linking Issues: Why a Trailing Slash in the URL Does Matter

Ann Smarty

09/8/09

33 Comments

I’ve often had debates with my web developers about this issue: "Why these links have a trailing slash "/" at the end and those don’t?", I asked. "It doesn’t matter, it works either way", was the answer.

Well, to begin with, if you get such a reply from a web developer, start looking for another one because this answer is profoundly incorrect, to say at least. When it comes to an URL, every single character matters, I like it how Sebastien put it in his totally cool post on stealing the trailing slash from the URL:

Think of URLs as phone numbers. When you call 555-0100 you reach the switchboard, 555-0101 is the fax, and 555-0109 is the phone extension of somebody. When you steal the last digit, dialing 555-010, you get nowhere… Well, the last digit of a phone number and the trailing slash of a directory link aren’t much different. If somebody hands out an URL (with trailing slash), then use it as is, or don’t use it at all. Don’t “prettify” it, because any change destroys its serviceability.

But this post is not actually about the web development (I am not an expert there, just citing), this is about link building. When you build links, make sure to use the URL version used by the site you are promoting: either with or without the trailing slash. Make sure to define which one is being used and stick to it.

Why is that important? Well, the best answer is that you need to stay on the safe side, because there are different ways servers handle the issue:

  • Sometimes, it doesn’t matter for SEO: many web servers will just re-direct using 301 status code to the default version;
  • Some web servers may return a 404 page for the non-trailing-slash address = wasted link juice and efforts;
  • Some web servers may return 302 redirect to the correct version = wasted link juice and efforts;
  • Some web servers may return 200 response for both the versions = wasted link juice and efforts as well as potential duplicate content problems.

Here’s just one recent example (which actually prompted me to write the post). W3C.org link checking tool found a link on seosmarty.com blog linking to my SEJ post without "/" at the end; here’s the actual report:

Missing trailing slash

33 Comments

  • Jason says:

    Very good sharing till now i don’t have any significant knowledge about this and usually i don’t use trailing slash . If you find more regarding this then do share.

  • It definitely matters. I have sites that wont even show the PR of the link if i dont use the / . If I go to the link w/out the / then it is a gray bar for PR

    It’s important to be consistent!

  • Andrea Moro says:

    Thanks for sharing the info with us Anny. Particular interesting the sample you’ve cited. It’s even better than those one I already used.

  • I have always wondered about this. I guess it’s like including the www in a URL, as opposed to lazily leaving it off.

  • Sudhani says:

    I agree with you totally. As an SEO, one should be very cautious about the trailing slash. Typically, all search engines display the URLs with a slash. So, always include it when promoting sites (via links).

    For search engines, the URL with trailing slash may be completely different from the one without it.

    Thanks for sharing the info.

    -Sudhani

  • MONI says:

    Definitly this is a very impotant tip when its come to link building. Thanks for sharing.

  • Geoff says:

    For web server performance I’ve heard it said that the trailing slash should be added. Why? When “www.mycompany.com/directory_name” is used the web server has to determine if the “directory_name” is a file that should be run or if it’s actually a directory that’s holding a “index.html” type file. This can slow the web server down.

    By using the trailing slash such as “www.mycompany.com/directory_name/” the web server knows that it’s working with a directory and can jump right to looking for the “index.html” type file.

  • Alphonse Hà says:

    So how can we know which one (with or without the trailing slash) is the correct form?

    In Twitter, a character can help a lot. Although, Twitter all have nofollow anyway but still…

  • Here’s an example

    http://twitter.com/shoemoney/ No Pagerank

    http://twitter.com/shoemoney (removing the slash) gives PR 6

  • Matthew Egan says:

    I want to point out that the reasons given in the article are not nearly as valuable as the reasons given in the comments following. The / or not the / given as a reason for why your site will not be reached, by a user, is a poor example to base an article around and I expect better (and better spelling, jeez) from a “award winning blogger”.

    The information about the web servers performance is excellent, and perhaps the SEJ should be having these seemingly more knowledgeable people contributing content about Server performance in SEO vs. someone who knows more about Link Building than Web Protocols and how they communicate with search spiders.

    • Ann Smarty says:

      Who do you call “award winning blogger”? :)

      The point of this post was not to describe the tech issues (I linked to the post which already did a great job covering that, why would I do that again?) Instead, the point was to emphasize why that should be taken into account when building links.

  • Eric Ward says:

    When you click on a link, you are basically telling a web server to process a file request. The content provider can give you many varieties of links that will ultimately result in you seeing the content they want you to see. Each varient puts a load on the server. I think it’s simply good practice and polite to require the server to do the least amount of work possible when processing a file request. Unfortunately, this isn’t always the most advantageous way to build links. Of the below example variants, all of which produce the same content result, which is most polite to the server?

    http://www.uga.edu/index.html
    http://www.uga.edu/
    http://www.uga.edu
    uga.edu/index.html
    uga.edu/
    uga.edu

    See the problem?

  • The whole ‘it doesn’t matter’ idea really is common out there to those that don’t know better. When I look over sites for the first time I always check to see how they’re handling www vs non-www, trailing slash vs no trailing slash, and if they’re using a file name like index or default for them home page. So many sites have duplicates this way!

  • Sebastian says:

    Ann, thanks for the kind mention :)

    Matthew, I guess you’ve missed out the “But this post is not actually about the web development (I am not an expert there, just citing), this is about link building.” part ;)

    As for the “best URI”, I’d say that’s the URI that doesn’t change. Never has to change. When you for example go with HTTP URIs like
    http://example.com/identifier/
    then today you serve /identifier/index.html, tomorrow /identifier/default.php, and in 200 years /identifier/ancientcontent

    As long as you prevent user agents from requesting your default documents by file name, the URI /identifier/ can never change, that means your links stay valid as long as you operate the server example.com.

  • Geoff says:

    I agree with Sebastian, it’s best practice to have the “home” page in a sub-directory not be directly called so that when you switch technology the links don’t have to be updated. For example:

    Instead of doing:
    http://www.mycompany.com/account/home/index.jsp

    Just do:
    http://www.mycompany.com/account/home/

    So that when you switch over to PHP technology you don’t have to do:
    http://www.mycompany.com/account/home/index.php

    You can just leave you links as there are.

    The trick is to be consistent on your site – when linking internally make sure you include the trailing slash, like, Account Home. If you mix and match, when Google crawls your site, it’s going to have to guess which one is which. Google might think you’re just some inconsistent web developer that doesn’t really care about that page and thus may give it less link juice.

  • Geoff says:

    Also, using the “www” canonicalization part of your domain name is another issue. On our site, we don’t reference the domain name at all in any of our links, we use relative links like the one above. Then we set the “www” preference in Google web master tools. See link below for more on the “www” issue:
    http://www.mattcutts.com/blog/seo-advice-url-canonicalization/

    Again, my understanding is that using the trailing forward slash more efficiently uses web server resources thus making for faster page load times in the long run. So for us, we always use trailing forward slashes.

    The article makes a good point whatever you do with your trailing slashes, you should do it consistently. Now that we know, it would be good to hear a bit more – like:

    Are their any odd-ball SEO implications for using a trailing forward slash in a URL? Is it worth doing a URL re-write or 301 redirect if the non-slashed version is requested?

  • Great post Ann. For anyone using wordpress you can easily force a trailing slash on URL’s with the “Robots Meta” plugin.

    http://yoast.com/wordpress/meta-robots-wordpress-plugin/

  • I also prefer the -www version of a site for the same reasons as using the trailing slash. Many browsers have a CTRL+enter keyboard shortcut that will automatically prepend a domain with www. and append it with .com/. Any time a visitor uses this keyboard shortcut to visit a site directly, the same scenarios that you outlined as bulletpoints would arise.

  • Matt Dunlap says:

    I had a problem with trailiing slashing in wordpress so I ended up making my permalinks all have the .html extension

  • SEO-Doctor says:

    Going through your client’s existing backlinks and checking the urls are correct could have a positive impact. But if they have 20K of backlinks this is some work.

  • Ankush Kohli says:

    Excellent article. As internet marketer, I was thinking of the same since a long time but didn’t exploded like this.

    Thanks!

  • A trailing slash should be used as that is the correct format of an URL. If you type into your address bar, a website address without a trailing slash, you will notice that the browser bar instantly updates to include it. This is the server automatically redirecting you to the correct address.

    In terms of using the slash or not, it usually doesn’t matter for joe-user as most (if not all) servers will perform this automatic redirect, however…

    The server is having to do extra work – one extra instruction. If your website gets 10 visits a day, that’s no biggie. But should your website feature on the front page of Digg and you start receiving thousands of visitors a minute, these extra instructions can take their toll.

    So from a user POV, it’s not too much of a problem. From a website optimisation POV, definitely include your slashes!

  • The comments have been very valuable on this post. I am glad to see SEO’s sharing their ideas like this. I was reading on StuntDubl.com how often SEO’s hide their methods in a way that keeps it an industry secret, and out of reach of the average joe.

  • Robert White says:

    I think Ann’s point to maintain consistency is correct and is advice that should be followed 100% of the time!

    But I think that there are multiple issues coming out of the discussion that have different factors to be considered.

    Examples of split links:
    domain.com vs. domain.com/
    domain.com/folder/ vs. domain.com/folder

    are not going to split authority like it would if you split links like:
    domain.com vs domain.com/index.html or http://www.domain.com

    *** That’s because the non www version vs www represent technically different files – same with the index.html

    Now with blog or other database scripted sites that rewrite urls it important because /blog/post-1/ does not necessarily mean /post-1/ is a catgory index. Its actually a long url rewritten by the htaccess. The shoemoney twitter example is probably related to this as well – except potentially two different pages based on same db output – although im guessing on the twitter thing.

    In general – Ann is correct in it being good practice to be consistent – especially with file extension variations and subdomains like www vs non www and even http vs https – however… the trailing slash on standard category indexes will not have same split authority effect and the difference should be mentioned.

  • Robert White says:

    correction – I said “category index” I meant “folder index”

    Just to clarify ;)

  • Noah says:

    It does matter, but as you said not so much if you have a proper 301 redirect in place. In fact, this is something that people should take care of when they initially set up their site as they can’t count on people always linking to them with the proper format (traiiling slash, no trailing slash, www, no ww, whatever). Best to setup the redirect and make as many of those links count as you possibly can.

  • Ann,

    Thanks for making case for trailing slash consideration. This was a clear and compelling article, and I just referenced it with a big client, and invited him to read the article himself…

  • Chris says:

    Hi Ann. Thanks for this informative issue. If the slash is missing, some server dumps an error. A lot of developers unfortunately don´t know or forget this. For now on I will better including the trailing slash on my links.

  • cpu20.com says:

    Hello Ann, Thank you very much for this comprehensive article about the trailing slash – I was so puzzled if it REALLY makes a difference or if I can just ignore the differences – but of course you are right pointing out the various problems and I better get my htacces in shape..:]
    Greetz from Berlin, t..

  • Peter says:

    When your developers replied “It doesn’t matter, it works either way” they were actually correct, and your snide comment “if you get such a reply from a web developer, start looking for another one because this answer is profoundly incorrect, to say at least” is unjustified.

    Because they were answering a question on a technical level, while you were asking on a wider field. For most web servers and browsers, there is no difference and the user can visit either URL and reach the same page.

    Don’t slag your developers off publicly without considering you may both be right, but dealing with different questions using the same words.

Leave a Reply