User makocisa asked this question and I have the same requirement:
Continuing the discussion from Use DNS to force youtube into restricted mode - and Pi-Hole:
I'd like to redirect
twitter.com/[postid]
to
nitter.net/[postid]
(Same technique would apply with youtube/ invidious)
I've tried configuring the CNAME records as described in that thread (and adding the return to the hostfile), and it seems to work with ping just fine. Unfortunately, because of SSL, actually browsing doesn't work. Browsers flag the SSL difference and don't load the page.
Which is fair, I'm basically doing a MITM attack.
Is there any way to do this on a Pihole at the network level? Or is this something that, for network reasons, would have to happen with a local browser extension or something?