redirect_from BS ?

I’ve notice some entries in the log where folks are just poking around. Is it possible to ‘trap’ these and redirect_to something valid like the site’s home page?

Thanks,

Bill

Hi Al,

Thanks for your reply. More below.

Al Evans wrote:

Bill Walton wrote:

I've notice some entries in the log where folks are just poking around. Is it possible to 'trap' these and redirect_to something valid like the site's home page?

Sure. I'm working on a site right the requirements to visit a specified page can be complex. I use something at the top of each method like

bad_action and return if ...

I've got before_filters in place for that sort of thing. What I was thinking / wondering about is something at a higher level that would catch attempts to invoke controllers / actions that don't exist. I guess I'm asking 'is there some way to redirect to a valid page (like the site's home page) rather than just throwing a 404 'Page not found'?

I'm guessing I should have marked this [OT] now that I think about it. It's probably something that has to happen outside the Rails app. I just don't know enough about the architecture to know where the 'trap' should be set. Where / what decides that a 404 error gets thrown and that it should display 404.html? Is it configurable so that I could set it to display my home page instead?

Thanks, Bill