From: Hassan Schroeder Date: 2012-10-25T20:31:06+09:00 Subject: Re: Googlebot- How to generate a 404 error status after a if statement On Thu, Oct 25, 2012 at 4:06 AM, Pierre d. wrote: > def index > > begin > page = StaticPage.find_by_id!(53) > @text = page.text params[:locale] > > rescue ActiveRecord::RecordNotFound > flash[:notice] = t :page_not_found > redirect_to index_url > end > end > > I will add "response.status=404" in it. Uh, well. That won't work if you're doing a redirect; "redirect" means "send a status 302". You can't do both. > But what should I write in the > index.rhml in my if statement, instead of my "meta > http-equiv="refresh"?: That said, I don't understand why you're redirecting to the same page; why not just return a "not found" response and text? Though for this locale issue, a 406 Not Acceptable might make more sense... -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan