Custom routes

0 views
Skip to first unread message

ry an

unread,
Sep 5, 2006, 8:14:01 PM9/5/06
to rubyonra...@googlegroups.com
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...

--
Posted via http://www.ruby-forum.com/.

Robert Gabaree

unread,
Sep 5, 2006, 8:30:01 PM9/5/06
to rubyonra...@googlegroups.com
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.

Priyanka Pathak

unread,
Jul 31, 2008, 12:05:07 PM7/31/08
to rubyonra...@googlegroups.com
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 Pathak
Software Engineer
Gloscon Solution Pvt. Ltd.

Reply all
Reply to author
Forward
0 new messages