URIs Moving documents
I came across one of the first tests of my new URI format today. I wanted to post an update to the timezone plugin, but I wanted to keep the previous version around. Hmmm…multiple stories on the same topic? That sounds like a job for a category. Sadly, the obvious category for this (/software/blosxom/plugins/timezone) was already taken by my previous version, which was sitting on these URIs:
- /2003/software/blosxom/plugins/timezone: the perl plugin
- /2003/software/blosxom/plugins/timezone_about: the blosxom article about the plugin
- /2003/software/blosxom/plugins/timezone_pod.html: documentation for the plugin
I’m not using the full date in my URI, so I only get to reuse a path once a year. Fortunately I got lucky because we just entered a new year. That means /2004/software/blosxom/plugins/timezone is available for me to use. Here are the new URIs I laid out:
- /2004/software/blosxom/plugins/timezone/: the category (main URI for the timezone plugin)
- /2004/software/blosxom/plugins/timezone/about_0_0_2: the blosxom article about version 0.0.2
- /2004/software/blosxom/plugins/timezone/about_0_0_3: the blosxom article about version 0.0.3
- /2004/software/blosxom/plugins/timezone/pod_0_0_2: the documentation for version 0.0.2
- /2004/software/blosxom/plugins/timezone/pod_0_0_3: the documentation for version 0.0.3
- /2004/software/blosxom/plugins/timezone/timezone_0_0_2: version 0.0.2 of the plugin
- /2004/software/blosxom/plugins/timezone/timezone_0_0_3: version 0.0.3 of the plugin
So, I moved the old files to the new locations, added the new files, and updated my metadates so they were all correct. I then updated my .htaccess to add 301 redirects for the old URIs:
...
Redirect permanent /2003/software/blosxom/plugins/timezone_about \
http://zovirl.com/2004/software/blosxom/plugins/timezone/
RedirectMatch permanent /2003/software/blosxom/plugins/timezone_about\.(.*) \
http://zovirl.com/2004/software/blosxom/plugins/timezone/index.$1
Redirect permanent /2003/software/blosxom/plugins/timezone \
http://zovirl.com/2004/software/blosxom/plugins/timezone/timezone_0_0_2
Redirect permanent /2003/software/blosxom/plugins/timezone_pod.html \
http://zovirl.com/2004/software/blosxom/plugins/timezone/pod_0_0_2.html
...
Finally I posted the new version. Overall it was a fairly simple task. I got lucky with the new year, in the future I’ll have to be more careful when I post stories I know will turn into categories in the future.
Update: Found one more gotcha: my internal links are generated using the absolute plugin. When I move files, old references to them need to be updated in my blosxom stories, otherwise absolute can’t find the files and doesn’t generate the right links.
Update 2: It really makes more sense to set the directories up like this:
http://zovirl.com/2004/software/blosxom/plugins/fullcategory/v0_0_1/about.blosxom
http://zovirl.com/2004/software/blosxom/plugins/fullcategory/v0_0_1/fullcategory
http://zovirl.com/2004/software/blosxom/plugins/fullcategory/v0_0_2/
...