棘手的重定向/重写

问题描述 投票:0回答:1

我搜索了这个,但没有发现......

我的旧网站是:cs.abc.edu/~cs4096 我的文件是:[email protected]/public_html 我的个人网站:myname.com 我的Github Pages网站:myname.github.io

当用户请求cs.abc.edu/~cs4096时,他们将获得cs.abc.edu/~cs4096/index.html等服务。

通过托管myname.com的ISP,我设置了一个将teaching.myname.com指向myname.github.io的CNAME。

我希望将旧网站的引用(包括顶部index.html下面的页面)发送到teaching.myname.com,通过DNS CNAME的魔力将URL发送到myname.github.io网站。换句话说,用户仍然去cs.abc.edu/~cs4096,但他们是从github.io服务。

teaching.myname.com - > myname.github.io位工作正常。这是失败的初始重定向/重写。问题是~cs4096在传递给myname.com时包含在URL中。

就是这个

http://cs.abc.edu/~cs4096

最终成为

http://teaching.myname.com/index.html~cs4096

代替

http://teaching.myname.com/index.html

还有这个

http://cs.abc.edu/~cs4096/Schedule

最终成为

http://teaching.myname.com/index.html~cs4096/Schedule

代替

http://teaching.myname.com/Schedule

并且,如果你想知道为什么我在这里做两个“重定向”,那是因为想要自动重建github页面,我无法在abc.edu或myname.com上获得。

谢谢你们

url redirect url-rewriting
1个回答
0
投票

没关系......我放弃了这个想法并使用了HTML重定向。它会在浏览器中弄乱“返回”,但它可以工作。

© www.soinside.com 2019 - 2024. All rights reserved.