title: Grails UrlMapping Redirect to keep DRY
body: <p>I am working with <code>Grails 2.1.1</code> and would like to add a handful of customized URLs that map to Controller Actions.  </p>
  
  <p>I can do that, but the original mapping still works.  </p>
  
  <p>For example, I created a mapping <code>add-property-to-directory</code> in my <code>UrlMappings</code> as follows:</p>
  
  <pre><code>class UrlMappings {
  
      static mappings = {
          "/add-property-to-directory"(controller: "property", action: "create")
          "/$controller/$action?/$id?"{
              constraints {
                  // apply constraints here
              }
          }
  
          "/"(view:"/index")
          "500"(view:'/error')
      }
  }
  </code></pre>
  
  <p>Now, I can hit <code>/mysite/add-property-to-directory</code> and it will execute <code>PropertyController.create</code>, as I would expect. </p>
  
  <p>However, I can still hit <code>/mysite/property/create</code>, and it will execute the same <code>PropertyController.create</code> method.  </p>
  
  <p>In the spirit of DRY, I would like to do a 301 Redirect from <code>/mysite/property/create</code> to <code>/mysite/add-property-to-directory</code>.  </p>
  
  <p>I could not find a way to do this in <code>UrlMappings.groovy</code>.  Does anyone know of a way I can accomplish this in Grails?  </p>
  
  <p>Thank you very much!</p>
  
  <p><strong>UPDATE</strong> </p>
  
  <p>Here is the solution that I implemented, based on Tom's answer:</p>
  
  <p><strong>UrlMappings.groovy</strong></p>
  
  <pre><code>class UrlMappings {
  
      static mappings = {
  
          "/add-property-to-directory"(controller: "property", action: "create")
          "/property/create" {
              controller = "redirect"
              destination = "/add-property-to-directory"
          }
  
  
          "/$controller/$action?/$id?"{
              constraints {
                  // apply constraints here
              }
          }
  
          "/"(view:"/index")
          "500"(view:'/error')
      }
  }
  </code></pre>
  
  <p><strong>RedirectController.groovy</strong></p>
  
  <pre><code>class RedirectController {
  
      def index() {
          redirect(url: params.destination, permanent: true)
      }
  }
  </code></pre>