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.
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.
And to help the curious... Content Negotiation
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)
Comments and Feedback