Pointers/Help with Routes


I’ve just finished porting a php website to rails (apache + mongrel +
rails). It’s my first rails app and things are working pretty well. I
have some basic questions on routing.

I want to change the routes so that I can redirect people to the main
page if they visit an old book mark e.g. www.foo.com/page.php would
display a custom 404 page informing the use to update their book mark.

Also I want the app to be more robust and not display errors if people
enter garbage urls. Currently if I enter
http://www.foo.com/feedback/action/5 I get:

Unknown action

No action responded to action

I would think that would display the 404.html file too but it’s not.

Does anybody have some simple help on this or a pointer to a good
tutorial on this? All the ones I can find are on avoiding the 404 page.
I actually want that.

Thanks for any help.



On custom error messages:

As for re-directing the requests, take a look at the following site as
it might give you a way to re-direct the user straight to the page they
want (depending on how much your site structure has changed and how
logical it was previously) which would not only be of more help to your
users but would be beneficial for search engine rankings if that is a
concern. Alternatively you can just re-direct anything with a .php
extension to your custom error page:

Hope that helps

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs