I was reading an article referenced by Jeff Atwood about Yahoo’s “Best Practices” for speeding up a website, and I noticed this little gem:
One of the most wasteful redirects
happens frequently and web developers
are generally not aware of it. It
occurs when a trailing slash (/) is
missing from a URL that should
otherwise have one. For example, going
to
http://astrology.yahoo.com/astrology
results in a 301 response containing a
redirect to
http://astrology.yahoo.com/astrology/
(notice the added trailing slash).
This is fixed in Apache by using Alias
or mod_rewrite, or the DirectorySlash
directive if you’re using Apache
handlers.
Does this still happen? The article is pretty old, as the web goes. I think I’ve been doing this for years. I don’t think I’ve noticed this happening lately, but then again I’ve never really looked. Is this an Apache thing? Does IIS 7 do this?
I’m scared. Hold me.
Try it!
Here are some truncated requests run from the terminal.
Though it seems that IIS does it the other way:
Guess it depends how you have it configured, but it’s definitely something to optimise.