In my Grails application, I have a couple of domain classes, say Authorand Book. I use the default URL mappings:
static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
}
So the relative url to show the book with id 2 is /book/show/2. To show the author with id 5 it /author/show/5. Both the class Authorand Bookhave the property name, but it is not guaranteed to be unique.
For SEO reasons, I would like to include this name in these URLs, for example. change the url to show the book to /book/show/2/the+davinci+codeand the url to show the author /author/show/5/dan+brown.
In order not to violate the existing (external) links to my pages, I would ideally want to support both formats, so that either of the following actions displays a Dan Brown page
/author/show/5/author/show/5/dan+brown
, (URL ), (URL- )?