Make a website to forbid access to anyone except another domain

I have two websites, and

I want to make it the way that anyone who tries to access get a 403 forbidden error. Except when it’s that tries to access, this way I want to redirect to another URL.

Something like:

All IPs > 403 forbidden exclusively > some other url

I know it’s possible to do with Apache natively by editing .htaccess this way:

Require forward-dns
RewriteEngine on
RewriteRule ^(.*)$ https://other\.url\.com/$1 [L,R=302]

But with CyberPanel, the first part (require forward-dns) doesn’t work. Everyone who visits gets redirected to some other url, not only

What would be my best option?

For the context, is not intended for any unauthorized access, it’s a tunnel (with a checkpoint) to media content located on a CDN network I want to mask with tries to access, gets redirected to, then shows picture.jpg to the viewer. Everyone else see as and get 403 if they try to access it.