User Tools

Site Tools


bugzilla

Table of Contents

Bugzilla

Pretty URLs

Using Apache's mod_rewrite, it is possible to give Bugzilla pretty URLs for certain pages.

  • /assigned-to/me@example.com/

    lists all bugs that are assigned to the specified email address

  • /reported-by/me@example.com/

    lists all bugs that were reported by the specified email address

  • /new-bug/

    redirects to the page listing all products to create a new bug report about

  • /new-bug/Product Name/

    shows the form to create a new bug for the specified product

  • /graph/

    shows our Open Bugs vs. Resolved Bugs graph

  • /open/

    lists all open (new/assigned/etc.) bugs

  • /unassigned/

    lists all unassiged (i.e. just the 'new' status) bugs

  • /fixed/

    lists all fixed (resolved-fixed) bugs

  • /123/

    shows bug #123

.htaccess

The .htaccess (mod_rewrite) code needed to accomplish this is: .htaccess|<syntax lang="apache"> <IfModule mod_rewrite.c> RewriteEngine on #Need this because we're symlinked RewriteBase /bugs/ #And enter_bug.cgi?product=Foo -> /new-bug/Foo/ RewriteCond %{QUERY_STRING} ^product=([[A-Za-z0-9%\+\-_]]+)$ RewriteRule enter_bug\.cgi new-bug/%1/? [[L,R=301,NE]] #Move /new-bug/ to enter_bug.cgi (i.e. new-bug without a product specified) RewriteRule new-bug/?$ enter_bug.cgi [[L,R=301,NE]] #Alternative rules for POSTed forms RewriteCond %{REQUEST_URI} (post_bug|process_bug)\.cgi RewriteRule .+/(.+) $1 [[L,NE]] #Move show_bug.cgi?id=123 -> /123/ RewriteCond %{QUERY_STRING} ^id=([[0-9]]+)$ RewriteRule show_bug\.cgi %1/? [[L,R=301,NE]] #This fixes CSS/etc. and also permanently redirects link destinations (e.g. /assigned-to/foo@example.com/report.cgi to /report.cgi) RewriteRule (assigned-to|reported-by)/.+@[[a-zA-Z0-9\-\.]]+/(.+) $2 [[L,R=301,NE]] RewriteRule (new-bug)/[[^/]]+/(.+) $2 [[L,R=301,NE]] RewriteRule (open|unassigned|fixed|graph|[[0-9]]+)/(.+) $2 [[L,R=301,NE]] #Append a trailing slash if necessary RewriteRule (assigned-to|reported-by)/(.+@[[a-zA-Z0-9\-\.]]+)$ $1/$2/ [[L,R=301,NE]] RewriteRule (new-bug)/([[^/]]+)$ $1/$2/ [[L,R=301,NE]] RewriteRule (open|unassigned|fixed|graph|[[0-9]]+)$ $1/ [[L,R=301,NE]] #Make the actual assigned-to etc. URLs work RewriteRule assigned-to/(.+@[[a-zA-Z0-9\-\.]]+)/$ buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=Product+One&product=Product+Two&product=Product+Three&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=exact&email1=$1&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Importance&field0-0-0=noop&type0-0-0=noop&value0-0-0= [[NE]] RewriteRule reported-by/(.+@[[a-zA-Z0-9\-\.]]+)/$ buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=Product+One&product=Product+Two&product=Product+Three&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&resolution=INVALID&resolution=WONTFIX&resolution=DUPLICATE&resolution=WORKSFORME&resolution=MOVED&resolution=---&emailreporter1=1&emailtype1=exact&email1=$1&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0= [[NE]] RewriteRule new-bug/(.+)/$ enter_bug.cgi?assigned_to=&blocked=&bug_file_loc=http\%3A\%2F\%2F&bug_severity=normal&bug_status=NEW&comment=&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text\%2Fplain&data=&deadline=&dependson=&description=&estimated_time=0.0&form_name=enter_bug&maketemplate=Remember+values+as+bookmarkable+template&op_sys=All&priority=P3&product=$1&rep_platform=All&short_desc=&version= [[NE]] RewriteRule graph/$ chart.cgi?category=Sihnon&datefrom=&dateto=&label0=CURRENTLY_OPEN&label1=RESOLVED&line0=27&line1=5&name=24&subcategory=Hosts&action=wrap&width=1000&height=650 [[NE]] RewriteRule open/$ buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=Product+One&product=Product+Two&product=Product+Three&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&resolution=WORKSFORME&resolution=---&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0= [[NE]] RewriteRule unassigned/$ buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=Product+One&product=Product+Two&product=Product+Three&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=UNCONFIRMED&bug_status=NEW&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0= [[NE]] RewriteRule fixed/$ buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=Product+One&product=Product+Two&product=Product+Three&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=FIXED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0= [[NE]] #The &dummy is needed to prevent the "show_bug.cgi?id=123 -> /123/" rule writing it BACK to /123/ RewriteRule ^([[0-9]]+)/?$ show_bug.cgi?id=$1&dummy [[L]] </IfModule> </syntax>

Note that in certain places the products need to be listed. These should be entered in the form “

product=Product+One&product=Product+Two&product=Product+Three

”. Additionally, the

/graph/

rule will need editing to match your own graph configuration. And finally, you only need the “

RewriteBase

” line if the URLs that you use to access Bugzilla don't match up with the filesystem - e.g. if you use a symlink to point Apache at the Bugzilla files.

bugzilla.txt · Last modified: 2014/11/24 01:14 by 0.0.0.0