Running Drupal from a sub-directory with htaccess
Judging by the amount of activity at http://drupal.org/node/144643 this is common issue for Drupalers.
There are a lot of good reasons to run Drupal in a directory other than root and it has certainly saved me a lot of headaches when clients have asked for something else installed alongside Drupal on the same host and makes staged upgrades a snap.
The process is remarkably simple with a little .htaccess magic.
Assuming you installed Drupal in a sub-directory of your webroot called drupal your root directory .htaccess should look like this:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/drupal
RewriteRule ^(.*)$ drupal/$1 [L]
Then you need to uncomment the /drupal/sites/default/settings.php base_url value and enter the correct top level domain for your site:
$base_url = 'http://www.mysite.com';
If you need to exclude another directory from these rewrite rules, for example if you wanted to run phpmyadmin on the same server and you wanted to access a stats directory you would need to add the following to the root .htaccess file:
RewriteCond %{REQUEST_URI} !^/(phpmyadmin|stats)/.*$
Any additional exclusions would follow the same pattern of |excludedir and can be added and removed via the root .htaccess file anytime. It's a simple bit of code that makes managing a Drupal site much easier.
