UPDATE: You probably now want my Debbugs Enhancement Suite.
Debian bug #846500 requests that the Bug Tracking System moves the canonical URL for a given bug from:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=846500
… to the shorter, cleaner and generally less ugly:
https://bugs.debian.org/846500
(The latter currently redirects to the former.)
However, whilst we wait for a fix we can abuse the window.history object from the HTML History API to fake this locally:
var m = window.location.href .match(/https:\/\/bugs.debian.org\/cgi-bin\/bugreport.cgi\?bug=(\d+)(#.*)?$/); if (!m) return; for (var x of document.getElementsByTagName("a")) { var href = x.getAttribute("href"); if (href && href.match(/^[^:]+\.cgi/)) { // Mangle relative URIs; <base> tag does not DTRT x.setAttribute('href', "/cgi-bin/" + href); } } history.replaceState({}, "", "/" + m[1] + window.location.hash);
This should work with most "user script" managers — I happen to use TamperMonkey in Chrome.
UPDATE: You probably now want my Debbugs Enhancement Suite.