Drupal-check.org - htaccess http://www.drupal-check.org/check/44 en Move .htaccess content to Apache config http://www.drupal-check.org/node/72 <p>Having an .htaccess file is a pain regarding performances. Apache needs to read it on every single request (the page, every image, CSS files, JS files, etc.).</p> <p>It is strongly recommended to move rules defined in Drupal <span class="geshifilter"><code class="geshifilter-text">.htaccess</code></span> file in your Apache global configuration or in your vhost configuration file. This way all rules are only loaded 1 time, during Apache start.</p> <p>To achieve this, just copy/paste your .htaccess content in your Apache server configuration file and don't forget to surround it by the directory where your Drupal install resides.</p> <p><div class="geshifilter"><div class="apache geshifilter-apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">Directory</span> /var/www/path/to/drupal/directory/&gt;<br /> &nbsp; <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">None</span><br /> &nbsp; <span style="color: #adadad; font-style: italic;">### &nbsp; &nbsp; &nbsp;ALL YOUR .HTACCESS CONTENT GOES HERE &nbsp; &nbsp;###</span><br /> &lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;</div></div></p> <p>Note that we added <span class="geshifilter"><code class="geshifilter-text">AllowOverride None</code></span> to prevent Drupal <span class="geshifilter"><code class="geshifilter-text">.htaccess</code></span> to be read by Apache.</p> <p>Check for syntaxe error:</p> <p><span class="geshifilter"><code class="geshifilter-text">$ apachectl configtest</code></span></p> <p>And restart Apache:</p> <p><span class="geshifilter"><code class="geshifilter-text">$ apachectl restart</code></span></p> <p>Note that if you are on Plesk, you must use the following command before restarting Apache:</p> <p><span class="geshifilter"><code class="geshifilter-text">$ /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=example.com</code></span></p> Optimization apache htaccess rewrite rules Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 13:10:28 +0000 jchatard 72 at http://www.drupal-check.org