Redirecting URL in Ruby on Rails
(Diary of an Old AI Researcher who is still Programming)
2 July 2019
I am retiring from University of Tokyo in March 2022, and, perhaps,
my homepage in ailab.t.u-tokyo.ac.jp will be shut immediately at that time.
I have checked the access statistics of my home page
and have found that the page
titled `Difference between Engineering and Science' has an extremely high
access score and is cited in several sites. So, I have decided to redirect
the page in ailab.t.u-tokyo.ac.jp to the page in koichihori.tech right now.
However, this is not so easy, because my page is dynamically generated
by my own program and I should rewrite my program.
It took a while before I recalled what my program, which I wrote six years ago,
is doing. :-)
Finally, I have inserted the following four lines in one of my controller
programs built in the framework of Ruby on Rails.
('status 301' means this redirection is permanent.)
if params[:id] == "9"
redirect_to("https://www.koichihori.tech/kougaku_jp.html", status: 301)
I do not think this is a beautiful solution, but, it is working.
To the extent possible under law,
the person who associated CC0
with this work has waived all copyright and related or neighboring
rights to this work.