title: Zend Framework 2 URL Rewrites
body: <p>I'm using the Zend Framework 2 and the shipped <code>.htaccess</code> for URL rewrites, which looks like this:</p>
  
  <pre><code>RewriteEngine On
  # The following rule tells Apache that if the requested filename
  # exists, simply serve it.
  RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^.*$ - [NC,L]
  # The following rewrites all other queries to index.php. The
  # condition ensures that if you are using Apache aliases to do
  # mass virtual hosting, the base path will be prepended to
  # allow proper resolution of the index.php file; it will work
  # in non-aliased environments as well, providing a safe, one-size
  # fits all solution.
  RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
  RewriteRule ^(.*) - [E=BASE:%1]
  RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
  </code></pre>
  
  <p>Additionally I have routes defined like: <code>/customers/8080/edit</code>. Now I need to this route to be also accessible per <code>/customers/edit/8080</code>. The additional URL should rather be an alias than a simple redirect.</p>
  
  <p>Because my routing is already massively complex, rewriting my routes in <code>module.config.php</code> is really no option. I thought the easiest way to achieve this would be to add rewrite conditions in my <code>.htaccess</code> and define the route <code>/customers/edit/8080</code> simply mapping to <code>/customers/edit/8080</code>.</p>
  
  <p>Since ZF redirects every URL to the <code>index.php</code> I'm stuck on defining my alias routes.</p>
  
  <p>Any advice would be awesome (: </p>