Redirect Globe requests to Atlas

Quoting Tim, isis, and Lunar from tor-project@:

Tim: Can we redirect globe.torproject.org to atlas.torproject.org?

isis: We could probably do this without so much effort, yes. For fingerprints the redirect would be from e.g.:

https://globe.torproject.org/#/relay/A10C4F666D27364036B562823E5830BC448E046A to https://atlas.torproject.org/#details/A10C4F666D27364036B562823E5830BC448E046A

For searches it would be:

https://globe.torproject.org/#/search/query=noether to https://atlas.torproject.org/#search/noether

Lunar: As far as I understand web technologies, the anchor is not sent to the HTTP server. So the rewriting can only be done via JavaScript and not through Apache.

Suggestion: How's this code? (Please improve, this is the result of ten minutes searching on the internets!)

<html>
<body>
<script type="text/javascript">
(function () {
    var atlas = "https://atlas.torproject.org/"
    var hash = window.location.hash.substring(1);
    if (!hash) {
        window.location.replace(atlas);
    } else if (hash.startsWith("/relay/")) {
        window.location.replace(atlas + "#details/" + hash.substring(7));
    } else if (hash.startsWith("/search/query=")) {
        window.location.replace(atlas + "#search/" + hash.substring(14));
    } else {
        window.location.replace(atlas);
    }
})();
</script>
</body>
</html>