3 things to consider regarding URL’s

There are often questions about how to link to certain pages or whether to include a slash or not. And if one should use www or shouldn’t use it.

The question here is not what the right thing is. The question is just how you want it to be. And that is the most difficult part in here. You have to decide with which method you want to go. What do you want your links to look like? Do you want to use ‘www’, because everyone expects it to be there or do you think ‘Hey, who needs thats?’.

So make your decision. But just pick one of all possiblities. You can’t have it all. “I want this, and this, and one of these…” Nope, not possible. Just one.

After you have decided, go with that method. Build your links that way. Then you can use mod_rewrite to ensure that everyone uses your pages the same as you. That means you redirect everyone who does not use www to the www version, if you decided to use www. If you decided to use trailing slashes after directory names, then always link to them that way. And redirect wrong requests to the appropriate pages.

Here are some points in which you should make a decision:

1. domain name

www.example.com or example.com

2. home page

should it be just / (highly recommended) or should it be /index.php, /index.htm, /home/start.asp

3. directories or pages

/about or /about/

Published by

Julian Bez

Julian Bez

Julian Bez is a software engineer and former startup founder from Berlin, Germany.

  • Peter

    My recommendations:

    1. example.com – www. is just an annoying subdomain. Double-u-double-u-double-u-dot is superfluous.

    2. none. It has not to care what type of language some uses. Maybe you want to change the system from .asp to .php. So it’s better to use only “/”

    3. /about/ – On Unix /about would be an file. A call to /about makes the server to ask for a file /about and when it isn’t found, the call for a directory /about/. That’s double work for the server to do.