Trailing Slash – Use Proper URLs

Recently I decided to incorporate proper link structure on my sites so they can improve their loading times, and be search engine friendly.

When linking to the homepage from an internal page, which URL is the best choice?

A. http://www.mydomain.com
B. http://www.mydomain.com/index.html
C. http://www.mydomain.com/

Explanation

A. 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’. 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/.

This forces the web server to work harder than it needs. By giving the server a hint as to what it needs to look for, your site loads a little faster and your visitors save a small amount of waiting time.

B. http://www.mydomain.com/index.html

This is not a good choice because there is no room for expandability. Suppose you want to change your site’s technology from html to php. You would need to update all your URLs in order to make the change. If you used http://www.mydomain.com/, you wouldn’t have to change all your URLs.

By using a trailing slash directory structure, visitors will have a harder time figuring out what programming language your web site
uses.

C. http://www.mydomain.com/

Always use a trailing slash on directory URLs (including homepages).

  • Saves the web server a redirect
  • Saves visitors some time
  • Makes it easy for you and the crawler

Tips

1. Make sure other sites use the trailing slash when linking to your home page.
2. Be consistent with your link structure.

Resources

URL canonicalization

Speak Your Mind

*