开发者

301 redirect of entire site in Rails

I am going to move my web application to a new domain name and want to use 301 perman开发者_StackOverflow中文版ent redirect for all incoming traffic to the old domain name.

I was going to use a before_filter in the application controller that does a permanent redirect. I was wondering how exactly I would write this to catch all urls and pass them 'as is' to the new domain name.

I am aware this can be done through apache or higher level, but I wanted to know how I would do this from the web application if I needed to.


If you can, delegate the job to your web server. Don't use Rails. Otherwise, use Rack Metal.

See

  • Reroute old content (.html/.php etc.) to Ruby on Rails
  • Redirect non-www requests to www urls in Rails
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜