I thought about doing this back when I had my own server, but since I could just set up another site on the server to solve it, I never looked into it deeply. Now that my server has expired and I’ve moved my blog to GitHub, that’s no longer an option. So, I went looking for a solution.
The Failed Attempt
Even though it failed, I’m documenting it anyway. I probably just didn’t know how to use it.
I previously tried playing around with just DNS CNAME records, but gave up when it didn’t work. This time, I searched for “redirect domain to path URL” and found a tool via the first search result ( https://cloud.tencent.com/developer/ask/sof/89340 ): http://redirect.center/ .
Example
Redirecting from https://acg.yexca.net to https://blog.yexca.net/acg .
Result: Inaccessible.
According to the site’s description, the CNAME content should be blog.yexca.net.opts-slash.acg.opts-https.redirect.center.. However, it didn’t work as expected and threw an error.
I tried a few variations, but they all errored out. I gave up and looked for another way.
Note: The last part of the website’s introduction has an auto-generator.
A New Tool
I searched for “redirect center” and found https://redirect.name/ as the third result.
This tool is much easier to use and, more importantly, it actually works.
New Example
Redirecting from https://twinkle.yexca.net to https://yexca.github.io/MusicPlayer-Twinkle/ .
Result: Accessible.
Two records are required:
| Type | Name | Content |
|---|---|---|
| CNAME | twinkle | alias.redirect.name |
| TXT | _redirect.acg | Redirects to https://yexca.github.io/MusicPlayer-Twinkle/ |
Code format:
| |