Linking to Your Home Page

Published in Web Development on Tuesday, October 19th, 2004

Over at the j-blog a nice post about urls, roots, and consistency.

Julian and his beautifully blue blog asks "Why link to index.php?". He also goes on to talk about to use or not to use www, which was discussed here not too long ago.

He concludes that you need not bother linking to index.whatever, and I would agree. I have a feeling that many people simply aren't aware that linking to the root can be done, or that they are effectively posting two (or more) urls for the same document.

Comments and Feedback

I'm also in the habit of always linking to the root ("/") instead of to a specific file name. In fact, I always try to avoid linking to file names, and link to directories, real or virtual, instead. It makes URLs much neater, and I'm not stuck with any .html, .php, .asp or whatever file extensions. In case anyone's interested, I collected links to a few resources on URLs and URL rewriting a while back: URL rewriting.

Nice, thanks Roger!

When linking internally (eg: navigation) I'm a little more lazy about linking to root folders instead of files. Out in the wider web though, I have only ever posted links to my site in one format - no www and no file name.

I never really thought about any indexing benefits, but consistency is always a Good Thing.

Just use 'Multiviews on'. It works and is absolutely great.

When I just had my own server to worry about I used mod_rewrite too. The problem is that I don't... My host uses Windows Server 2003 with IIS-servers - that's no mod_rewrite.

Although there are a few solutions (like IIS Rewrite) my host doesn't want to spend that much money ... just to satisfy me.

So, if anyone knows a way to rewrite URIs with IIS: let me know! (my gmail-adress is noted at my website)

Home » Blog » Web Development

Check out the blog categories for older content

The latest from my personal website,

SiteUptime Web Site Monitoring Service

Sitepoint's web devlopment books have helped me out on many occasions both for finding a quick solution to a problem but also to level out my knowlegde in weaker areas (JavaScript, I'm looking at you!). I am recommending the following titles from my bookshelf:

The Principles Of Successful Freelancing

I started freelancing by diving in head first and getting on with it. Many years and a lot of experience later I was still able to take away some gems from this book, and there are plenty I wish I had thought of beforehand. If you are new to freelancing and have a lot of questions (or maybe don't know what questions to ask!) do yourself a favor and at least check out the sample chapters.

The Art & Science Of JavaScript

The author line-up for this book says it all. 7 excellent developers show you how to get your JavaScript coding up to speed with 7 chapters of great theory, code and examples. Metaprogramming with JavaScript (chapter 5 from Dan Webb) really helped me iron out some things I was missing about JavaScript. That said each chapter really helped me to develop my JavaScript skills beyond simple Ajax calls and html insertion with libs like JQuery.

The PHP Anthology: 101 Essential Tips, Tricks & Hacks

Like the other books listed here, this provides a great reference for the PHP developer looking to have the right answers from the right people at their fingertips. I tend to pull this off the shelf when I need to delve into new territory and usually find a workable solution to keep development moving. This only needs to happen once and you recoup the price of the book in time saved from having to develop the solution or find the right pattern for getting the job done..