[Rails] 301 Redirect with Rails

Cody Fauser codyfauser at gmail.com
Wed Feb 8 13:52:45 GMT 2006


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 at yahoo.com> wrote:
> 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
>
>
>
>
>  ________________________________
>  Yahoo! Mail - Helps protect you from nasty viruses.
>
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
Cody Fauser
http://www.codyfauser.com


More information about the Rails mailing list