A slight performance increase for Apache is to turn off the per-directory configuration files (.htaccess), and insert them into the virtual hosts configuration file. For each Symfony project that I set up the vhost file looks something like:

<code markup="none">
<virtualhost>
    ServerAdmin webmaster@dummy-host.example.com
    ServerName site.com
    ServerAlias www.site.com
 
    DirectoryIndex index.php
 
    DocumentRoot /path_to_doc_root/web
 
    Alias /sf /path_to_symfony/PEAR/data/symfony/web/sf
 
    ErrorLog /path_to_log/log/error_log
    CustomLog /path_to_log/log/access_log combined
 
    HostnameLookups Off
 
    UseCanonicalName On
 
    ServerSignature Off
 
    <directory>
 
        Options All
        AllowOverride None
        Allow from all
 
  <ifmodule>
    RewriteEngine On
 
    RewriteCond %{REQUEST_URI} \..+$
    RewriteCond %{REQUEST_URI} !\.html$
    RewriteRule .* - [L]
 
    RewriteRule ^$ index.html [QSA]
    RewriteRule ^([^.]+)$ $1.html [QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
 
    RewriteRule ^(.*)$ frontend_dev.php [QSA,L]
      </ifmodule>
 
    </directory>
    <directory>
        Allow from all
    </directory>
 
</virtualhost>
 
</code>
Leave a Reply