title: Symfony2 - Redirect a route to an external URL
body: <p>I have this route in the local project: </p>
  
  <pre><code>/test/test2.php?param1=a&amp;param2=b....
  </code></pre>
  
  <p>I would like to redirect it to an external URL:</p>
  
  <pre><code>http://test.com/test/test2.php?param1=a&amp;param2=b....
  </code></pre>
  
  <p>How to do it using Symfony?</p>
  
  <p>I was trying to use the routing directly without a Controller</p>
  
  <pre><code>test:
  path: /test/{rest}
  defaults:
      _controller: FrameworkBundle:Redirect:redirectUrl
      path: http://test.com/{rest}
      permanent: true
  </code></pre>
  
  <p>But I am loosing the parameters: test2.php?param1=a&amp;param2=b....</p>
  
  <p>I was also trying to use the controller Action:</p>
  
  <p>Routing:</p>
  
  <pre><code>test:
  path: /test/{rest}
  defaults:
      _controller: MyBundle:Default:test
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public function oaiAction($rest)
  {
      return $this-&gt;redirect('http://test.com/'.$rest);
  }
  </code></pre>
  
  <p>But I am loosing the parameters.</p>
  
  <p>Any idea? I only need to change the local project base url to the remote one by keeping all the parameters.</p>