A recent projects has been to clean up the server running this site. One of the goals for this was to move the drupal files out of the webroot and to the Debian provided package location.

I started out by aliasing the directory

<br /> Alias /m /usr/share/drupal6<br />

and added the following rewrite rules.

<br /> #If this is the root, send it to drupal<br /> RewriteCond %{REQUEST_URI} ^/$<br /> RewriteRule ^(.*)$ http://jhulst.com/m/$1 [S=3] #Check if file exists, if so, serve it up<br /> rewriteCond %{DOCUMENT_ROOT}/$1 -f [OR] rewriteCond %{DOCUMENT_ROOT}/$1 -d [OR] #Special exception for an aliased directory<br /> rewriteCond %{REQUEST_URI} shelljoust/wiki<br /> rewriteRule (.*) - [S=2] #If we aren't in the root and the file doesn't exist,<br /> #let drupal try and handle it<br /> RewriteCond %{REQUEST_URI} !m/<br /> RewriteRule ^(.*)$ http://jhulst.com/m/$1<br />

This first section checks if we are requesting http://jhulst.com and sends it to Drupal at http://jhulst.com/m

If we aren’t requesting the root, we check to see if the files or directory exists in /var/www and uses them first. This lets me put documents in /var/www and still be able to link to them at the top level of jhulst.com

If the files don’t exist under /var/www, the request is handed off to Drupal for final processing or error messaging.