Directory Restructuring

For quite a while now, I’ve been thinking that the original directory structure I chose for my website didn’t quite match my needs. The only problem was, I didn’t want to break any links that already point to existing documents in those directories. The directories I wanted to move were /xhtml/, /css/, /zengarden/ and /script/. I wanted to put zengarden under CSS, and group the XHTML, CSS and Script directories under a single development directory, which I decided to call /dev/.

The solution I found was to move them as described, and use Apache’s Redirect directive from mod_alias. The rules I added to my .htaccess file took this form

Redirect permanent /xxx http://www.lachy.id.au/dev/xxx

Where xxx represents the XHTML, CSS, Script and ZenGarden directories. This directive causes Apache to respond with an HTTP 301 Moved Permanently status code, and the location for the user agent to find the actual resource. The only problem is that I needed to use the full URI, rather than a relative path for the redirection, which means that the same directives won’t work as I wanted for my testing server on my localhost, since any request for http://localhost/css/, for example, will redirect to http://www.lachy.id.au/dev/css/, rather than http://localhost/dev/css/.

So, the problem is solved, and I’ve got a much more appropriate, and hopefully permanent directory structure. This will benefit a lot for my CSS Zen Garden submission, Office 2003, which is listed in the Themes and Look-alikes section. It still uses the old URI, so if it broke, anyone wanting to see my design would be disappointed to see an unstyled document. There are also several other links on various other sites that I know about, and possibly others that I don’t, so it was very important that existing URIs didn’t break.