Nicer Bugzilla URLs

06 Feb 2007

If you've got Bugzilla running in your company you know what the URLs for a bug look like: http://mybugzilla.com/show_bug.cgi?id=123. That's fine, but it's a bit of a pain to type into an email or an indi comment. It'd be nicer to be able to just put http://mybugzilla.com/123 and get to the right bug. This is easy with a little mod_rewrite rule; just put this in your Bugzilla's virtual host definition:

  RewriteEngine On
  RewriteRule ^/([0-9]+)$ /show_bug.cgi?id=$1 [PT]

This rule rewrites any request that consists of one of more digits as a "passthru" to the default bug display URL. We could probably use a RedirectMatch instead, but, hey.

Thanks to Rich Bowen for his excellent mod_rewrite book; it's been extremely helpful for making little improvements like this. Good stuff!