How can I redirect all https://www.A.net/Page.html requests for some page Page.html to the corresponding page on another domain https://www.B.net/Page.html via the https://www.A.net/404.html? Github/Gitlab Pages redirects all Page-not-found errors to the latter. Is it possible to somehow retrieve the original requested page and use this in a Javascript (jQuery) function to modify the redirection URL?
I currently use something like the following HTML code for a many-to-one redirection, but I rather need a one-to-one redirection (i.e. not always to the same https://www.B.net/404.html).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="refresh" content="0; URL=https://www.B.net/404.html">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0"/>
</head>
<body>
You are being redirected to https://www.B.net/404.html <a href="https://www.B.net/404.html">https://www.B.net/404.html</a>
</body>
</html>