The concept of ending URLs with a trailing slash is not a new one, but many companies I deal with everyday pay little attention to how they structure their URLs when launching new websites.
How do you deal with the trailing slash on your website’s URL?
The Technical Issues
http://www.example.com.au/page
This URL (without the trailing slash) is not telling the server exactly what kind of file to look for, so the server will take an educated guess at the type of document you are trying to locate. The server will begin by checking for a ‘page’ directory and retrieve the default page for this directory if it exists.
If this directory doesn’t exist, it will continue to try to match other options until it finds a matching page or returns a 404 Page Not Found error. This costs you unnecessary server load and will increase load times for your web pages.
http://www.example.com.au/page/
This URL (now with the trailing slash) is telling the server exactly what to look for without the guessing. The server now looks in the ‘page’ directory and will retrieve the default document within that directory. No guessing means the server does it’s job quickly and efficiently.
There are other issues of expandability and security using this method as well that are well worth reading in the this great ALA article on the subject.
The SEO Issues
What many people don’t realise is that these two URLs can also be considered as two different URLs pointing to the same page:
http://www.example.com.au/page/
http://www.example.com.au/page
If you have two instances of virtually the same URL being used on your websites, Google may filter one of them and decide to index the other. More details on this concept of URL canonicalisation can be found in this article by Matt Cutts.
Which URL Google decides to filter may not be up to you and this can split your organic search engine traffic in half if you are not addressing the issue and forcing the search engines to solve this problem on their own.
Your priority here, as with the technical solution above, is to make sure the search engines do not have to guess which URL is correct and to make sure it is absolutely obvious which URL you have chosen as your primary URL.. This can be done in a few ways.
- Internal URLs
- make sure you use the same URL consistently across you website when linking to it from navigation or through internal linking
- External URLs
- you can’t control how people link to your website and chances are they are going to leave the trailing slash off the URL because it’s just easier.
- redirect or rewrite all instances of the URL without the trailing slash to the version with the trailing slash
The Trailing Slash is Your Friend
- If you do not think about your URL structure on your website you could:
- cause unnecessary strain on your server
- serve web pages that take longer to download
- host pages that are harder to find on search engines.
Many people are aware of the problems of URL canonicalisation and take some steps to control it’s effects, but many are still unaware of the problems caused by the trailing slash not being applied consistently across you website.
With a few simple decisions and technical implementations you can easily improve the overall efficiency and findability of your website.