Merb.logger.info("Compiling routes...") Merb::Router.prepare do # This is the default route for /:controller/:action/:id # This is fine for most cases. If you're heavily using resource-based # routes, you may want to comment/remove this line to prevent # clients from calling your create or destroy actions with a GET default_routes # Change this for your home page to be available at / match('/').to(:controller => 'static', :action =>'show', :path => '/index') # If a template is found in app/views/static, send it to the page-cached static controller # Probably want to add something here to check for an index template in app/views/static/request/path ie. /request/path(/index.html.erb) match(/.*/).defer_to do |request, params| # See if a template matches for the requested URI in the Static controller, matching any content type # Will only route to the static controller if a template is found # ie. /foo/bar/template_exists will match # /foo/bar/a_template_that_does_not_exist will not match, and will continue through the route matching if Merb::Template.template_for(Static._template_root / "static#{request.uri}.*") params.merge :controller => 'static', :action => 'show', :path => request.uri end end end