Search code examples
grailshttp-status-code-404url-mapping

Grails URL Mappings. Redirect 404 to URL e.g. http://www.mysite.com/404.html


In my URL mappings I would like to send my application to an extrernal webpage URL for 404 errors. So, if my 404 page is hosted at http://www.myorganisation.com/404.html I would like my URL mapping to be:

"404"(uri:"http://www.myorganisation.com/404.html")

However, this does not work. I have also tried replacing 'uri' with 'url' with no success. Is this even possible?


Solution

  • "404"(controller: "watevercontroller", action: "wateveraction")
    

    And then within your "wateveraction"

    redirect(url: "http://www.myorganisation.com/404.html")