views:

225

answers:

1

I am going to move my web application to a new domain name and want to use 301 permanent 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.

+1  A: 

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

See

Simone Carletti