Tricky redirect/rewrite

Multi tool use


Tricky redirect/rewrite
I searched for this one, but found nothing ...
My old site is: cs.abc.edu/~cs4096
My files were at: cs4096@cs.abc.edu/public_html
My personal site: myname.com
My Github Pages site: myname.github.io
cs.abc.edu/~cs4096
cs4096@cs.abc.edu/public_html
myname.com
myname.github.io
When a user requests cs.abc.edu/~cs4096
they are served cs.abc.edu/~cs4096/index.html
and so on.
cs.abc.edu/~cs4096
cs.abc.edu/~cs4096/index.html
Via the ISP hosting myname.com
, I setup a CNAME pointing teaching.myname.com
to myname.github.io
.
myname.com
teaching.myname.com
myname.github.io
I want references to the old site, including pages below the top index.html
, to be sent to teaching.myname.com
where through the magic of DNS CNAME the URL goes to the myname.github.io
site. In other words, users still go to the cs.abc.edu/~cs4096
but they are served from github.io
.
index.html
teaching.myname.com
myname.github.io
cs.abc.edu/~cs4096
github.io
The teaching.myname.com
-> myname.github.io
bit is working fine. It’s the initial redirect/rewrite that is failing. The problem is that the ~cs4096
is included in the URL when it is passed to myname.com
.
teaching.myname.com
myname.github.io
~cs4096
myname.com
That is, this
http://cs.abc.edu/~cs4096
ends up as
http://teaching.myname.com/index.html~cs4096
instead of
http://teaching.myname.com/index.html
and this
http://cs.abc.edu/~cs4096/Schedule
ends up as
http://teaching.myname.com/index.html~cs4096/Schedule
instead of
http://teaching.myname.com/Schedule
And, if you wonder WHY I’m doing two “redirects” here, it is because want the automatic rebuild of github pages that I can’t get at abc.edu or myname.com .
Thank you all
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.