knorv
knorv

Reputation: 50117

Creating a Grails catch-all URL-mapping

How do I create a catch-all URL-mapping in Grails?

The following Grails UrlMapping ..

class UrlMappings {
  static mappings = {
    "/$something"{
      controller = "something"
      action = "something"
    }
  }
}

.. appears to match ^/[^/]* but how do I create an UrlMapping matching all URLs (^/.*)?

Upvotes: 5

Views: 3728

Answers (1)

ataylor
ataylor

Reputation: 66059

You're looking for the ** "double wildcard". Example:

   class UrlMappings {
      static mappings = {
        "/**"(controller: "something", action: "something")
      }
    }

Upvotes: 15

Related Questions