Fixing trailing slash problems with blojsom…
So I was getting annoyed that I couldn't claim my weblog via Technorati without faking it, as blojsom requires a trailing slash at the end of the URL to go to the correct blog, and Technorati strips the slash from your url when you submit it.
Googling around brought up an entry by andwest talking about using UrlRewriteFilter to solve the problem. He'd set it up for a single case, but I wanted to get a general solution going, as I've got nearly 2000 blogs running on the staff and student blog servers here.
After faffing around a bit in Regular Expressions land with Java Pattern Matching, I ended up with this rule that seems to do the job happily enough.
<rule>
<from>^/blog/([a-z]*)([^/])$</from>
<to type="redirect">/blojsom/blog/$1$2/</to>
</rule>
This is with UrlRewrite just installed into the blojsom context, not the whole server, so it will rewrite an url like:
http://staff.cofa.unsw.edu.au/blojsom/blog/nigelkersten
to:
http://staff.cofa.unsw.edu.au/blojsom/blog/nigelkersten/