title: Symfony2 project in subdirectory
body: <p>I'm currently working on a Symfony2 application that, for the time being, has to be hosted inside a subdirectory. Normally one would change the DocumentRoot in the Apache vhost but this is currently not possible. It's also not possible to place anything in the root directory (e.g. above <code>public_html/</code>).</p>
  
  <p>The DocumentRoot is set at <code>/public_html/</code>. The structure with the Symfony2 app in a subdirectory looks like this:</p>
  
  <pre><code>- public_html/
  -- dev/
  ---- app/
  ---- bin/
  ---- src/
  ---- vendor/
  ---- web/
  </code></pre>
  
  <p>Without any special configuration the app can be reached at <a href="http://example.com/dev/web/app.php" rel="nofollow">http://example.com/dev/web/app.php</a>. I however want to change this to <a href="http://example.com/dev" rel="nofollow">http://example.com/dev</a> without having to move files around.</p>
  
  <p>I came up with the following <code>.htaccess</code>:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{REQUEST_URI} !dev/web/
  RewriteRule (.*) /dev/web/app.php/$1 [L]
  </code></pre>
  
  <p>This kinda works, but Symfony2 reports the following error: <code>No route found for "GET /dev/"</code>.</p>
  
  <p>If I change the RewriteRule to <code>RewriteRule (.*) /dev/web/$1 [L]</code> I can reach the app with <a href="http://example.com/dev/app.php/dashboard" rel="nofollow">http://example.com/dev/app.php/dashboard</a> (dashboard being an example of course) which results in <code>No route found for "GET hboard"</code>, notice <strong>hboard</strong>. Calling <a href="http://example.com/dev/app.php/" rel="nofollow">http://example.com/dev/app.php/</a> does render the page at / perfectly and links to all assets work fine as well.</p>
  
  <p>Any help would be much appreciated. In time this app has to move from <code>dev/</code> to <code>/</code> as well. So a solution for that is welcome as well.</p>