There are a few browser extensions available for this, with LibRedirect being, I think, the most popular one. They redirect privacy-invasive sites to more privacy-friendly alternative frontends. For example, every time you open a youtube.com link, it redirects you to an Invidious instance instead, opening the same video there.

LibRedirect doesn’t exist for my default browser, Safari, so I wanted to check whether there were any alternatives. There are. However, there’s something even better: an extension I’ve already been using for years, StopTheMadness Pro.

StopTheMadness Pro is a web browser extension that stops websites from making your browser harder to use, and it protects your privacy on the web. StopTheMadness Pro is not an ad blocker, but rather a one-of-a-kind extension with a huge number of unique features.
A few of StopTheMadness Settings

It has an endless list of features: allowing copy and paste, right-clicking even when websites block that, preventing sites from hijacking keyboard shortcuts, and so, so, so, so much more. It honestly is a must-have.

It also has a redirect feature. There’s no need for another extension. You can just use StopTheMadness to redirect twitter.com or x.com links to xcancel.com. It also syncs settings between devices, including from macOS to iOS and vice versa.

The setup is very easy: just add the main domain you want it to match and set the alternative domain as the replacement.

Now, when you open x.com/foobar, it will go to xcancel.com/foobar.

The LibRedirect site and this repository have lists of even more alternative frontends.