Don't Forget the Trailing Slash

Album Cover: Begin To Hope

"On the radio, you hear November Rain. That solo's awful long, but it's a good refrain."
Regina Spektor / On The Radio

Posted on April 12, 2005 6:40 AM in Browsers
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

While perusing through my feed subscriptions this morning, I was reminded of a simple web-browsing rule-of-thumb, so I thought I'd share it here.

The latest post at the IEBlog says:

When generating hyperlinks, always include a trailing slash if possible. For instance, navigating to http://msdn.microsoft.com/ie takes one more roundtrip than http://msdn.microsoft.com/ie/. When the browser navigates to the /ie url, the server merely sends down a 301 to the /ie/ url. Both links work, but the second version is faster.

Several months ago I was investigating some redirection I had setup on this site. I downloaded the LiveHTTPHeaders extension for Firefox and began looking at the HTTP headers being sent back and forth by my browser and my website as I browsed to various URIs.

What I noticed in the process was the behavior described over at the IEBlog. Whenever I typed in an address, I would get a 301 status code redirecting me to the exact same address with a trailing slash on the end. Ever since, I've made it a habit of including the trailing slash on the end of all applicable URIs I visit or link to.

You should too!

Comments

No one has added any comments.

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.