ECN No Name Newsletter: Fall, 1997

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article]

URL: Trailing Slashes

David Jacoby, Student Web Assistant
jacoby@purdue.edu

Trailing slashes--to use or not to use? Hopefully after reading this short explanation, you will be able to avoid making the most popular URL faux pas. For ECN Web servers, the URL and the filesystem are closely related. Although this is not always true, we will assume it for this article.

Using http://www.ecn.purdue.edu/Engr/general for the URL, the server will respond with a "Document moved" message along with the correct address, http://www.ecn.purdue.edu/Engr/general/ because general is a directory, not a file. Most people never notice this happening, though, because their browsers immediately respond by requesting the correct URL. Why is this a problem then?

Besides the potential for embarrassment by showing that you don't know your own URL, some technical problems can result by dropping the trailing slash. When you depend on the server to generate a new URL, it is possible that you will get a different page than you expect. For example, if you follow a link to http://jis.www.ecn.purdue.edu/JIS, you will be redirected to http://ce.ecn.purdue.edu/JIS/ This URL is likely to break some day when ce.ecn retires.

There's also an issue of network usage. When you type a URL by hand, a dropped trailing slash is not much of a problem; it results in a single small extra request and answer. However, when such a URL is on a popular page, the extra requests become significant and, at the least, slow access to the page for each user who has to wait for two requests to complete instead of just one.


webmaster@ecn.purdue.edu
Last modified: Tuesday, 14-Oct-97 10:55:05 EST

[HTML Check] HTML