Discuss in my forum
By Jennifer KyrninAugust 30, 2010
Follow me on:
Not so important if you configure your server to respond to both types of urls
Most servers are configured to respond to both with and without a slash. The issue isn’t whether the page loads or not, but how fast it loads.
And unless you’ve created two separate pages, one for the slash and one for without, one of the pages is going to redirect to the other one. And this slows down the page load.
The time I’m talking about is miliseconds, I admit. But for high-ranking sites, that type of speed difference is crucial. Google looks at how fast your page loads and two pages that are otherwise equal will be ranked according to speed – the faster one will come first.
Since this is a simple thing for most designers to do, it makes sense to do it. Then when you are competing for the number one slot in Google, you won’t have to worry about that speed issue.
But honestly, please continue to ignore it, because that just makes it easier for the rest of us to surpass you.
Thanks for the tip Jennifer! I always thought those slashes looked ‘ugly’ at the end of the url but now I know they’re important and I will not get rid of them anymore.
I agree that the trailing slash should be used. It tells the browser that you want it to go straight to a directory instead of a file.
Seems that 99% of the time URL’s should never be published with a slash at the end, since in just about all cases what you really want is a file. After all even someones home page is actually an index file, or whatever default file type the web server has been configured for.
If your goal is optimum web server performance, then ending a URL in a slash should be a no-no.
But sometimes optimal web server performance, should not be the goal.
@jimmy: I’m curious if you mis-read the article.
While you’re right that including a trailing slash on a URL that ends in a file name is incorrect, this won’t just result in slower performance. Many servers will return a 404 error in that situation. Because by adding the slash you’re telling the server to look for a directory not a file name. Even if the server redirects to the file name, by adding a slash in that situation, you’re adding load time by forcing the server to redirect.
When you’re pointing to a directory, such as on your domain root landing page, you should always end the URL with a slash. That’s what the article talks about. Because if you don’t, you’re forcing a redirect and adding load time to your documents.
I am curious, however. You say “sometimes optimal web server performance, should not be the goal.” Can you give an example of when optimal performance should not be a goal? I cannot think of any time when I wouldn’t want my pages to load as quickly as possible, and my server to perform as well, or optimally, as possible.
Thanks for the comment, and I’m looking forward to your response.
I teach an introduction to Web design class and after reading the tip about the leading slash just days ago.. I began teaching my students to add the leading slash.
I love all of you tips and have learned so much from you.
Thanks for educating me weekly….
<a href="" title="">
©2013 About.com. All rights reserved.