What seemed like a simple and straightforward question, gradually generated an informative discussion. So far, the quiz looks like a success – with quite a number of people choosing different answers.
So what did we learn from SEO Quiz – Part 1: URLs? I’ll start off by pulling out some comments and summarizing what people thought were the best practices. I’ll finish off with my own explanation.
My vote is for B or C. I don’t think it would make too much of a difference between the two.
Out of all the choices, most agreed that C was the best URL choice. Some noted they had learned of the correct URL structure in the past, but forgot why.
This is one of those things you learn, you have no idea where you learned it, and you are glad you happened to learn the right way.
There are a couple reasons why C is the better choice.
B is not a good choice because Apache servers need the trailing slash, and the way they get round it is to ask the requestor to request again but with the trailing slash added – a redirect to the proper URL. It may not be universal among Apache servers, and it may even be out of date, but as long as some servers do it that way, B isn’t the best choice.
It’s interesting that Google’s brand new Sitemap system needs the trailing slash in the URLs, so the redirect may be very common.
I’ll go for C on its own.
Lets take a look at http://www.mydomain.com
The browser communicates to the server, requesting ‘mydomain.com’. First the server looks for a file called ‘mydomain.com’ and can’t find anything. It then adds a trailing slash and tries to find a directory called ‘mydomain.com’ – bingo. Then the server returns the default file for the directory.
So if a browser requests http://www.mydomain.com instead of http://www.mydomain.com/, the visitor is actually being redirected to http://www.mydomain.com/.
Answer B forces the web server to work harder than it needs. By giving the server a hint as to what it needs to look for, you are saving your visitors the tiny wait.
Answer D is not a good choice because there is no room for expandability. Suppose you want to change your web site technology, lets say from pure html to php. You would need to update all your URLs in order to make the change. With answer C, you wouldn’t have to.
Another reason you want to use C is that you may not want to expose your web site’s underlying technology. By using a trailing slash directory structure, visitors will have a harder time figuring out what programming language your web site uses.
Answer A leaves the URL structure up to the server configuration. When Google goes to index the link, depending on the server configuration Google may index www.mydomain.com or mydomain.com – it is much easier and clearer to use absolute links.
A while back, GoogleGuy had this to say about relative URLs:
99.999% of the time a bot will be able to disambiguate relative urls, for example, but why leave that little bit of chance? I’m not saying that people should always use absolute urls–just that the simpler you make things for bots, the less likely you are to run into problems.
Always use a trailing slash URL for directory structures (including homepages). Why?
- Saves the web server a redirect
- Saves visitors some time
- Makes it easy for you and the crawler