Custom routes

I want to display the 404.html page for routes that are not defined in
my application. So if a visitor tries to visit
“http:://www.yoursite.com/undefined” instead of “Routing error” they
will get my 404.html page.

How can this be handled? Is there a way to setup something in routes.rb
for all routes not defined and/or not controller/action? Thanks…

Not sure if this is the best way to go about this, so hopefully
someone else will comment, but if you put:

map.connect ‘*anything’, :controller => “blah”, :action =>
“unknown_request”

at the end of your routes, it will map anything it doesnt recognize
to the “unknown_request” action.

ry an wrote:

I want to display the 404.html page for routes that are not defined in
my application. So if a visitor tries to visit
“http:://www.yoursite.com/undefined” instead of “Routing error” they
will get my 404.html page.

How can this be handled? Is there a way to setup something in routes.rb
for all routes not defined and/or not controller/action? Thanks…

Hi
I think you place your application in production environment.
when routes is not match then it gives 404.html page. so visitor get
your default error message instead of routing error.

Thanks
Priyanka P.
Software Engineer
Gloscon Solution Pvt. Ltd.

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