title: How do I get rid of the need for the "/app.php/" in a new Symfony2 app's production URL?
body: <p>I've done a 1st install of Symfony2,</p>
  
  <pre><code>    php app/console --version
          Symfony version 2.0.11 - app/dev/debug
  </code></pre>
  
  <p>I installed it under an existing DocumentRoot by configuring my apache2 server vhost</p>
  
  <pre><code>    &lt;VirtualHost 127.0.0.1:80&gt;
          ...
          DocumentRoot /srv/www/localhost_www
          ...
          &lt;Directory "/srv/www/localhost_www" &gt;
              AllowOverride none
              Options -ExecCGI +FollowSymLinks +Includes +Indexes +MultiViews
              Order Allow,Deny
              Allow from All
          &lt;/Directory&gt;
          ...
          Alias /TESTAPP  "/srv/www/TESTAPP/web/"
          &lt;Directory "/srv/www/TESTAPP/web/"&gt;
              Options All
              AllowOverride All
              Allow from All
          &lt;/Directory&gt;
  
          Alias /TESTAPP.symfony  "/srv/www/TESTAPP/"
          &lt;Directory "/srv/www/TESTAPP/"&gt;
              Options All
              AllowOverride All
              Allow from All
          &lt;/Directory&gt;
          ...
  </code></pre>
  
  <p>After an OK install, and successfully following "The Book" to build the demo "Hello" app, if I nav in a browser to any/all of,</p>
  
  <pre><code>  dev:
          http://localhost/TESTAPP.symfony/web/app_dev.php/hello/ME
          http://localhost/TESTAPP/app_dev.php/hello/ME
    prod:
          http://localhost/TESTAPP.symfony/web/app.php/hello/ME
          http://localhost/TESTAPP/app.php/hello/ME
  </code></pre>
  
  <p>I see the expected,</p>
  
  <p><strong>"Hello ME!"</strong></p>
  
  <p>I want to rewrite <em>only</em> the production URLs, hiding "app.php" so that the following set of URLs work in the nav bar of a browser for my Symfony2 app:</p>
  
  <pre><code>  dev:
          http://localhost/TESTAPP.symfony/web/app_dev.php/hello/ME
          http://localhost/TESTAPP/app_dev.php/hello/ME
    prod:
       !! http://localhost/TESTAPP.symfony/web/hello/ME
       !! http://localhost/TESTAPP/hello/ME
  </code></pre>
  
  <p>Iiuc, the default web/.htaccess</p>
  
  <pre><code>        cat web/.htaccess
                  &lt;IfModule mod_rewrite.c&gt;
                      RewriteEngine On
                      RewriteCond %{REQUEST_FILENAME} !-f
                      RewriteRule ^(.*)$ app.php [QSA,L]
                  &lt;/IfModule&gt;
  </code></pre>
  
  <p>needs to change.</p>
  
  <p>I've dug around in the docs and on the web, tried vdiffferent recommendations for modding the RewriteRule, adding 'RedirectMatch permanent', etc., and I'm not managing to get a simple</p>
  
  <p><a href="http://localhost/TESTAPP/hello/ME" rel="noreferrer">http://localhost/TESTAPP/hello/ME</a></p>
  
  <p>to ever work.  I always seem to need to add the "/app.php/".</p>
  
  <p>What are the specific changes I'd need to make in order to get this to work?</p>
  
  <p>Thanks.</p>
  
  <hr>
  
  <p>@chasen</p>
  
  <blockquote>
    <p>is mod_rewrite enabled for apache?</p>
  </blockquote>
  
  <p>yes  </p>
  
  <blockquote>
    <p>if you have your .htaccess file in your web directory</p>
  </blockquote>
  
  <p>i do  </p>
  
  <blockquote>
    <p>and you host file pointing to the web folder the</p>
  </blockquote>
  
  <p>it is, as above,  </p>
  
  <pre><code>    Alias /TESTAPP  "/srv/www/TESTAPP/web/"  
          &lt;Directory "/srv/www/TESTAPP/web/"&gt;  
  </code></pre>
  
  <blockquote>
    <p>app.php should not be needed.</p>
  </blockquote>
  
  <p>that's my problem.  without it, it's not working for me.  </p>
  
  <p>Specifically,</p>
  
  <pre><code>    https://localhost/TESTAPP/app.php/hello/ME
  </code></pre>
  
  <p>returns:</p>
  
  <p><strong>"Hello Me!"</strong></p>
  
  <p>but</p>
  
  <pre><code>    https://localhost/TESTAPP/hello/ME
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>Object not found!
  
  The requested URL was not found on this server.
  If you entered the URL manually please check your
  spelling and try again.
  
  If you think this is a server error, please contact
  the webmaster.
  Error 404
  </code></pre>