PHP code for blacklisting and rewriting/redirecting URLs
I think it looks good, a little verbose. Could be simplified to this

$oldurl = JUri::getInstance();
$bad_urls = ['match1','match2','match3'];
$newurl = str_replace($bad_urls, 'rewritewiththis', $oldurl);

if(in_array($oldurl, $bad_urls))
    exit(header("Location: $newurl", true, 301));


If you need to use something like this in many locations, or you need to elaborate on what are considered bad urls a router system/class may be a better way to go.

If you're asking if there's a different way to re-route without using header() I don't think there is. Any router system I have seen uses header() to re-route, no matter how much code surrounds and abstracts them.