Writing for the Web

Tips for the Web Editor

 

URLS

Remember to always put the "/" behind a directory name in URLs.  

Traditionally, URLs that pointed to files did not include the trailing slash, while URLs that pointed to directories do include the trailing slash. This means that:

http://webdesign.about.com/example/ is a directory, while 
http://webdesign.about.com/example is a file

This helps speed up page loading because the trailing slash immediately tells the web server to go to that example/ directory and look for the  index.html  or other default file.

When you go to a URL without the trailing slash, the web server looks for a file with that name. If it doesn’t find a file with that name, then it looks for a directory and looks for the default file in that directory.

Why it's bad  |  Leaving Off the Slash Results in a Redirect – Redirects Slow Down Web Pages

When you leave off the slash on a URL that is pointing to a directory, you are forcing the server to do a redirect. While it may seem instantaneous to you, it does take slightly longer for a page to load from a redirect than from the direct URL. And every little bit adds up.

But for file names , you should NOT include a slash at the end.  For example:

Type: 
http://webdesign.about.com/example.html 
Not: 
http://webdesign.about.com/example.html/