heisel.org > Blog > 2003 > 12 > 27 > Entry
The Duke of URLs
Saturday | December 27, 2003 | 4:17 pm
Whitespace has a good discussion going on about directory structure and thinking about it in advance.
Directory structure is important to system administrators, URL structure is important to designers.
But, Chris, you say, aren’t the two inherently linked? Won’t /www/news/metro23.html have to be http://www.site.com/news/metro23.html?
There was a dark time, when that was true, but then there was mod_rewrite, and it was good.
Without going into too much detail, you can use mod_rewrite to abstract the file structure from the URL structure. So, for instance, a one-off page like /contact.html could easily become the URL http://www.site.com/contact/.
Admittedly it would become excessive to have to rewrite every single URL on your site, so doing some basic planning between the file structure and your URLs at the outset is good.
But mod_rewrite could easily let you fix small differences between the file system and the URL.
For instance on a site I’m working on for my employer, I wanted to keep all the text-based content (not photo galleries or video, etc.) in a folder called /articles. This included columns which lived on the filesystem in /articles/columns/. But for URL purposes I wanted columns to be a top-level section of the site so a bit of mod_rewrite magic makes /columns/ point to /articles/columns/.
Where mod_rewrite can really shine, though, is in taming ungainly CMS generated URLs, like this one:
http://www.amazon.com/exec/obidos/ASIN/B00005JLF5/qid%3D1072559511/
sr%3D11-1/ref%3Dsr%5F11%5F1/002-5343588-7541623
A bit of mod_rewrite could turn that into something like this:
http://www.amazon.com/dvd/ds9/one
But, don’t take my word for it. (Hat tip)
Permalink | Comments (1) | Categories: Web design
Disclaimer: I work at The Atlanta Journal-Constitution. The opinions expressed here are my own, and do not reflect those of the AJC, Cox Newspapers, Cox Enterprises nor any other party.
Comments
Pay per click Search Engine Advertising August 26th, 2004 | Link to this comment |
Good point guys! You can search for more information at http://www.giveramp.com
as it’s better then Google for this type of topic.