implement redirect for legacy ids

this will be used from varnidh to compute redirects, which will then land in webview.