Seo Forum

Search Engines => Google Search Optimization => Topic started by: manvbf on 10-29-2011, 03:46:16

Title: 404 and Redirect Question
Post by: manvbf on 10-29-2011, 03:46:16
So I have the custom error pages set up and working fine, but I was just thinking of adding a META refresh that redirects to the site home page after 30 seconds or so. Has anyone tried this? Will the SEs be OK with this? Or will they think I'm "up to something"...?

Thanks!
Title: Re: 404 and Redirect Question
Post by: freeplusac on 11-07-2011, 21:35:50
hi

 Don't render 404 yourself, there's no reason to; Rails has this functionality built in already. If you want to show a 404 page, create a render_404 method (or "not_found" as I called it) in ApplicationController like this:

def not_found
  raise ActionController::RoutingError.new('Not Found')
end

Rails also handles AbstractController::ActionNotFound, and ActiveRecord::RecordNotFound the same way.

This does two things better:

1) It uses Rails' built in rescue_from handler to render the 404 page, and 2) it interrupts the execution of your code, letting you do nice things like:

  user = User.find_by_email(params[:email]) || not_found
  user.do_something!

without having to write ugly conditional statements.

As a bonus, it's also super easy to handle in tests. For example, in an rspec integration test:

lambda {
  visit '/something/you/want/to/404'
}.should raise_error(ActionController::RoutingError)

Title: Re: 404 and Redirect Question
Post by: takeshiro on 11-09-2011, 06:11:18
i agree that there is no reason for you to make a 404 page. there's, like, a default for that.
Title: Re: 404 and Redirect Question
Post by: eetplus on 01-18-2012, 05:46:53
I think it's good idea to redirect 404 page to home page after some seconds.
Title: Re: 404 and Redirect Question
Post by: smith on 01-18-2012, 23:12:38
Hi,
404 redirect of the website make it crawler friendly, otherwise there will be chances that the trust-ability of the site may decreased.
This will also increase the bounce rate of the site, try to avoid it.