Community

Main site in subfolder (Bluehost); rewrite rules issue; $base_url issue

I'm no expert on mod_rewrite, so I hope someone can help me with this problem. I'm running a multi-site installation of D7 on Bluehost. I have my main domain pointing to a subfolder of the root: /drupal7. My .htaccess file looks like this...

# Do not change this line.
RewriteEngine on
# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/drupal7/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /drupal7/$1
# Change yourdomain.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ drupal7/index.php [L]

I got it from Bluehost and changed the appropriate values to match my domain/folder names (not "example.com", obviously). In my settings file in Drupal, I have $base_url set to "http://example.com".

If I type: example.com (no trailing slash) - it goes to example.com (as expected)

If I type: example.com/ (WITH trailing slash) - OR...
www.example.com (no trailing slash) - OR...
www.example.com/ (WITH trailing slash)...
these last three example URLs all go to: example.com/drupal7/index.php (and, yes, it shows the "index.php" as well).

I've also tried this with $base_url set to "http://www.example.com", but it made no difference.

Comments

This may seem like a non-Drupal issue, but...

This may seem like a non-Drupal issue, but since one of the solutions I've tried was to set the $base_url in the settings.php file, and that seems to NOT be working, I've posted it here in the Dupal forum.

Has anyone else experienced problems with $base_url? Any solutions to suggest?

nobody click here