I absolutely agree about dated structures, and this technique is well
used by millions of blogs around the web. Apache's mod_rewrite makes
this pretty easy, and can also handle very complex URI translations. The
bottom line for me is to end up with a URI that is obvious and easy for
the user to remember, and I make sure that the application does the hard
work in translating the URI to display the right information.

So, I tend to use this document structure most of the time:

/root/
  /images/ - all content images
  /styles/v1/ - CSS for this particular site version (CSS make it easy
to redesign sites without modifying the HTML)
  /styles/c1/images/ - background images, icons etc
  /page1/
  /page2/
  /page2/sub-page1/
  /page2/sub-page2/
  /page3/

With my CMS that uses static files I save all the content HTML in a
directory called /content/ with the file name corresponding to the page
it is meant to be displayed on. This makes it a simple matter for the
server-side script to find the right page and display it.

So I only use "a-z", "0-9" and "-" (and /, obviously) in URIs, and
replace all the / with _ for the content files, like this:

  /page1/sub-page2/ -> /content/page1_sub-page2.html

You may have guessed, for very large sites it's a whole lot easier to
use a database! I use this technique to also map navigation, so nested
menus (drop menus with sub-sub lists, such as "About us > Profiles >
Chris") translate to the correct page ("about-us/profiles/chris/"). The
filesystem was designed as a system to store files, much like a database
is a system to store data, therefore it makes sense to logically group
related information into directories. The URI and the document that is
displayed do not necessarily have to be at exactly the same location.

So, I owe the developers of mod_rewrite (and the IIS version, URL
ReWrite - http://www.iismods.com/url-rewrite/index.htm) more beers than
I care to remember because they make it possible to redirect old
(deleted) pages. For example, I'm currently converting one of our
websites to CSS and wanted to redirect all old *.asp files to their
clean-url counterparts, and can do it with a handy 301 redirect. That
helps search engines as well as users.

(As an aside, I'm currently experimenting with this URI format as an
interface to a RESTful API, the domain just changes to
api.myapplication.com).

Anyway, there's my tuppence. YMMV!

Chris




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lachlan Hunt
Sent: 21 March 2006 03:58
To: wsg@webstandardsgroup.org
Subject: Re: [WSG] Re: Website Directory Structure - Best Practice

Richard Czeiger wrote:
> For example "Latest Mars News" for NASA, might be better served with 
> havng an index page with a linked archive of static URLs, or 
> permalinks for latest articles (like "/mars/news/060320.html").

I fully agree with what you're saying, but just have one minor issue. 
Dates in file names should always use 4 digit years (or more after
y10k).  I'm sure you all remember the y2k bug, let's not suffer again
with a y2.1k bug.  It's best practice to use ISO-8601 dates (with or
without the hyphen), especially in file names and it has the advantage
that sorting by name also sorts by date.

e.g. /mars/news/2006-03-20
Or maybe:
/mars/2006/03/20/article-title

--
Lachlan Hunt
http://lachy.id.au/
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to