Tuesday, November 07, 2006

Do end your URL's with a forward slash in your links

If you have a URL (web address) that does not specify an exact page, then you want to trail the URL with a forward slash:
<a href=" http://www.sitename.com/ ">Creating Web Sites</a>
In the above link, you will notice that after the '.COM' I placed a forward slash (/).
If the link were pointing to a particular page, I wouldn't add the forward slash at the end of the address:
<a href=" http://www.sitename.com/articles/index.htm ">Creating Web Sites Articles Page</a>
- By adding the forward slash (as in the first example), we remove a step that otherwise the web server and browser would have to take; removing this extra step can give you a speed boost. So to sum it up:
If your link is pointing to a particular file (an html page or a PHP page or an ASP page etc ...) you don't want to use the trailing slash. But if you are pointing to a directory like:
<a href=" http://www.sitename.com/articles/">Articles</a>
Then you want the trailing slash.

No comments: