SEO

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

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 Linking Issues: Why a Trailing Slash in the URL Does Matter

 Linking Issues: Why a Trailing Slash in the URL Does Matter
Ann Smarty is the blogger and community manager at Internet Marketing Ninjas. Ann's expertise in blogging and tools serve as a base for her writing, tutorials and her guest blogging project, MyBlogGuest.com.
 Linking Issues: Why a Trailing Slash in the URL Does Matter

Comments are closed.

43 thoughts on “Linking Issues: Why a Trailing Slash in the URL Does Matter

  1. 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.

  2. 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!

  3. 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

  4. 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.

    1. wat if we have page like state.html do we still need to add trailing slash to the URL… Maybe m not getting the concept.. can u please elaborate

  5. 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…

  6. 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.

    1. 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.

  7. 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?

  8. 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!

  9. 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.

  10. 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/

    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.

    1. Okay, how many people have seriously rebuilt a site using a new technology and not modified the navigation/URL/link structures anyway?

      1. Yes, usually you modify the navigation structure, often quite considerably. But the process described can simplify the process of redirecting old links to new locations.

  11. 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?

  12. 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.

  13. 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.

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

    Thanks!

  15. 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!

  16. 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.

    1. You mean StuntDuble.com/ :)

      (So now do all billboard posters advertising website have to add trailing slashes because if they don't then they don't mean the same address? :D)

      1. now do all billboard posters advertising website have to add trailing slashes because if they don’t then they don’t mean the same address?

        No. For a bare domain name, there is no difference between example.com/ and example.com. They mean exactly the same thing. (The version with the slash is technically more accurate, but the browser will send the same request to the server regardless. The version without the slash is more standard in writing. And it’s shorter, which is good.) When there is a path, the slash does make a difference, so example.com/a may or may not be the same as example.com/a/, depending on how the server at example.com is configured.

        For my sites, I serve the same content from both, but do a link rel=”canonical” from the version with the slash to the version without. And all internal links use the version without the slash. That makes sense to me.

        TRiG.

  17. 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.

  18. 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.

  19. 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…

  20. 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.

  21. 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..

  22. 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.

    1. Or they could have been answering a question in the specific, rather than the general. There may be cases where a trailing slash will make difference, cases where the difference is only in the workload on the server (ie no difference to end users), cases where it matters for SEO (eg the be consistent rule), and cases where there is effectively no difference at all. For a given site, it might not matter in an important way.

      When you ask a question like this, you might get the engineer’s answer “Well it depends…” or you might get the quick response. The “Well it depends answer” is often quite lengthy, but is far more informative.

  23. You mean StuntDuble.com/ :)

    (So now do all billboard posters advertising website have to add trailing slashes because if they don't then they don't mean the same address? :D)

  24. Okay, how many people have seriously rebuilt a site using a new technology and not modified the navigation/URL/link structures anyway?

  25. Hi. Nice post. Recent I read about Seo some information and I realized that the links with “/” and without “/” are different for Googlebot for example. Now I have the question how to resolve it. Can somebody help me in this question or point me to some information how can I do this. Thank you very much.