0

Suppose, my website is originally published at x.github.io. And I have another website y.github.io. My target is to redirect from 2nd one to the original one.

I like to redirect the subdirectories too such that when y.github.io/cv is visited, it should redirect to the page x.github.io/cv. How can I do it effectively?


For now, I am making it work by creating a subdirectory cv in the repository of y.github.io and adding the following index.html file in it:

/y.github.io
.
├── cv
│   └── index.html (2)
└── index.html (1)

index.html (1)

<!DOCTYPE html>
<html lang="en">
<body>
    <script>
        window.location.replace("https://x.github.io/")
    </script> 
</body>
</html>

index.html (2)

<!DOCTYPE html>
<html lang="en">
<body>
    <script>
        window.location.replace("https://x.github.io/cv/")
    </script> 
</body>
</html>

But I don't prefer this method. Instead, I like to configure it so that I won't have to update the repository of y.github.io each time I create any new subdirectory in the repository x.github.io.

2
  • Why are you creating new pages at the old site. This is not very Goggle Search friendly. Commented Aug 2 at 17:08
  • Sorry, what do you mean?
    – raf
    Commented Aug 3 at 1:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.