
I am a Drupal developer almost full-time now, and on my development server I have two subdirectories in the public_html folder: /drupal5 and /drupal6.
Try as I might, I have never been able to get the combination of $base_url in the settings.php file and the RewriteBase directive in the .htaccess file to correctly display sites in either of these subdirectories. In the best-case scenario, the sites would show up almost correctly, but any linked files or embedded images would not contain the correct path (ie /files/images/x.jpg instead of /drupal6/files/images/x.jpg).
My workaround? A little bit of htaccess voodoo. Essentially I modified an existing htaccess script that allows you to run drupal in a subdirectory–all I did was add some conditions that let the server know whether to route the traffic to the d6 directory or the d5 directory.
The fix is a three step process:
1) Name all of the sites in your development server differently depending upon whether they are on the drupal6 or drupal5 platform. All of the sites in my /drupal5/sites folder are named “locald5.site.com“, and all of the sites in my /drupal6/sites folder are named “locald6.site.com“.
2) Modify your Hosts file to reflect any site you add to your server. You’ve probably already done this, but if you haven’t here is a tutorial on modifying your hosts file in Mac OS X, and here is a tutorial on modifying your hosts file in Windows. For my fix, every additional entry in my hosts file looks like 127.0.0.1 locald[6 or 5].site.com
3) Insert the following into the .htaccess file in the ROOT of your webserver:
Options -Indexes
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^locald6.*
RewriteRule ^$ drupal6/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/drupal6%{REQUEST_URI} -f
RewriteRule .* drupal6/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*wiki.*
RewriteCond %{HTTP_HOST} ^locald6.*
RewriteRule .* drupal6/index.php?q=$0 [QSA]
RewriteCond %{HTTP_HOST} ^locald5.*
RewriteRule ^$ drupal5/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/drupal5%{REQUEST_URI} -f
RewriteRule .* drupal5/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*wiki.*
RewriteCond %{HTTP_HOST} ^locald6.*
RewriteRule .* drupal5/index.php?q=$0 [QSA]
Do this and your server should correctly route all of your drupal5 and drupal6 development sites! Good luck.