I am using the following code to do a 301 redirect in my controller: headers["Status"] = "301 Moved Permanently" redirect_to "/somepage" and return I am using nginx in front of mongrel cluster. When I tested the URL at http://checkmyheaders.com/, it returns the following info: HTTP/1.1 302 Moved Temporarily Server: nginx/0.7.59 Date: Mon, 27 Jul 2009 11:42:17 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive Set-Cookie: Status: 302 ............. What gives?? Is mongrel or nginx changing this to a 302 somewhere along the way?? -- Posted via http://www.ruby-forum.com/.
Codeblogger
2009-Jul-27 12:26 UTC
Re: Trying to use 301 redirect, but the server does a 302
Hi Yanni, have you tried this: redirect_to "/somepage", :status=>:moved_permanently Read http://api.rubyonrails.org/classes/ActionController/Base.html#M000662. Regards Nicolai
That worked great! Thanks! I guess the old way does not work with the latest version of rails. Nicolai Reuschling wrote:> Hi Yanni, > > have you tried this: > > redirect_to "/somepage", :status=>:moved_permanently > > Read > http://api.rubyonrails.org/classes/ActionController/Base.html#M000662. > > Regards > Nicolai-- Posted via http://www.ruby-forum.com/.