I use a Firefox extension to do it - https://einaregilsson.com/redirector/. You might be able to do some local DNS with a wildcard shenanigans, but this is much easier to set up.
I actually don't redirect my Reddit requests, since once in a blue moon I will want to comment on something, which libreddit doesn't support. However Invidious does have the option to let you follow certain channels, and since I don't comment on YouTube videos, it covers all of my use cases, so I redirect all Youtube traffic to it.
I actually don't redirect my Reddit requests, since once in a blue moon I will want to comment on something, which libreddit doesn't support. However Invidious does have the option to let you follow certain channels, and since I don't comment on YouTube videos, it covers all of my use cases, so I redirect all Youtube traffic to it.