I have Drupal installed in a subdirectory of public_html
on BlueHost.
It looks like this: /www/drupal7/mywebsite
.
I want to run the site out of the mywebsite
subdirectory instead of www
. However, I want the URL to appear to be http://mywebsite.com.
Here is the suggested .htaccess
configuration from BlueHost. This is the .htaccess
for the www/
directory; I am using the default Drupal 7 .htaccess
in Drupal's subdirectory.
# BlueHost.com
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.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} !^/subdirectory/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change example.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 ^(/)?$ subdirectory/index.html [L]
This successfully allows me to use Drupal from the subdirectory, but the URLs look like this:
http://www.mywebsite.com/drupal7/mywebsite/PAGE
But I want it to look like this:
This post on Drupal.org suggests that the $base_url must be set in default/settings.php
. I set the $base_url
to "http://mywebsite.com"; however, when I do this, whatever link I click, I am redirected to the front page.
Is there an additional step? What am I missing?
.htaccess
file ?