【问题标题】:Grails URL Mappings. Redirect 404 to URL e.g. http://www.mysite.com/404.htmlGrails URL 映射。将 404 重定向到 URL,例如http://www.mysite.com/404.html
【发布时间】:2012-10-19 15:48:51
【问题描述】:

在我的 URL 映射中,我想将我的应用程序发送到外部网页 URL 以解决 404 错误。因此,如果我的 404 页面托管在 http://www.myorganisation.com/404.html,我希望我的 URL 映射为:

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

但是,这不起作用。我也试过用'url'替换'uri'但没有成功。这甚至可能吗?

【问题讨论】:

    标签: grails http-status-code-404 url-mapping


    【解决方案1】:
    "404"(controller: "watevercontroller", action: "wateveraction")
    

    然后在你的“水上行动”中

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

    【讨论】:

      猜你喜欢
      • 2012-04-06
      • 2013-06-12
      • 1970-01-01
      • 2021-07-17
      • 1970-01-01
      • 2014-01-28
      • 2012-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多