Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url 棘手的重定向/重写_Url_Redirect_Url Rewriting - Fatal编程技术网

Url 棘手的重定向/重写

Url 棘手的重定向/重写,url,redirect,url-rewriting,Url,Redirect,Url Rewriting,我找了这个,但什么也没找到 我的旧网站是:cs.abc.edu/~cs4096 我的文件位于:cs4096@cs.abc.edu/公共html 我的个人网站:myname.com 我的Github页面站点:myname.Github.io 当用户请求时,cs.abc.edu/~cs4096将为其提供cs.abc.edu/~cs4096/index.html等服务 通过ISP托管myname.com,我设置了一个CNAME,指向teaching.myname.com,指向myname.github

我找了这个,但什么也没找到

我的旧网站是:
cs.abc.edu/~cs4096

我的文件位于:
cs4096@cs.abc.edu/公共html

我的个人网站:
myname.com

我的Github页面站点:
myname.Github.io

当用户请求时,
cs.abc.edu/~cs4096
将为其提供
cs.abc.edu/~cs4096/index.html
等服务

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

我希望对旧站点的引用,包括顶部
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://teaching.myname.com/Schedule
还有这个

http://cs.abc.edu/~cs4096/Schedule
最终成为

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

http://teaching.myname.com/index.html
http://teaching.myname.com/Schedule
如果你想知道我为什么在这里做两个“重定向”,那是因为我想要自动重建github页面,而我在abc.edu或myname.com上找不到


谢谢大家

没关系。。。我放弃了这个想法,使用了HTML重定向。它会把浏览器中的“Back”搞乱,但它可以工作