Forum: Ruby on Rails 301 Redirect with Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F68e4842b0a5487678e26046fdb2fdf3?d=identicon&s=25 softwareengineer 99 (Guest)
on 2006-02-08 14:32
(Received via mailing list)
I have been searching for a way to do this but haven't found anything
yet.

  Can anyone please guide me to a resource or tell me how I would go
about doing a 301 (Moved Permanently) redirect using Rails?

  Thanks
  Frank
2ccb2f7699267d258faaafce4ee997df?d=identicon&s=25 Cody Fauser (Guest)
on 2006-02-08 14:53
(Received via mailing list)
Frank,

Give this a try in your controller:

def moved
  headers['Location'] = 'http://the_new_location_of_your_page.html'
  render :nothing => true, :status => 301
end

On 2/8/06, softwareengineer 99 <softwareengineer99@yahoo.com> wrote:
>
>
--
Cody Fauser
http://www.codyfauser.com
F68e4842b0a5487678e26046fdb2fdf3?d=identicon&s=25 softwareengineer 99 (Guest)
on 2006-02-08 17:56
(Received via mailing list)
Hi Cody,

  Thanks for your reply.

  I believe that will do. I will check.

  Thanks

  Frank

Cody Fauser <codyfauser@gmail.com> wrote:  Frank,

Give this a try in your controller:

def moved
  headers['Location'] = 'http://the_new_location_of_your_page.html'
  render :nothing => true, :status => 301
end

On 2/8/06, softwareengineer 99  wrote:
>
>
--
Cody Fauser
http://www.codyfauser.com
This topic is locked and can not be replied to.