Hi All,

I'm posting this tutorial here because I wrestled with this issue for days (!!!) before finding an actual working solution.

Basically the issue is that I'm hosting multiple websites inside a single HostMonster account. And while you can point add-on domains to whatever subfolder you choose, the default domain in the account is pointed to the public_html folder and cannot be changed.

However, to keep everything neat and tidy, I want each site to be in a subfolder (for example: Site 1 in public_html/site1, Site 2 in public_html/site2, and so on), but I don't want the subfolder to show in the URL. In other words I want to mask the subfolder.

There are two steps to the process, and the second one is important when running Joomla 1.5.x (other CMS like Drupal may not be affected), otherwise the subfolder name will show in the site's URLs....

STEP 1:

First, we must redirect to the subfolder and mask URL. So, your domain is domain.com, which by default points to public_http, and you want it to go to the public_http/joomla2 subfolder instead. We do this using a .htaccess file placed in public_http. Copy and paste the following code into this file, and edit it per the instructions within.


Code:
# Hostmonster.com
# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.

# Do not change this line.
RewriteEngine on

# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$ [NC]

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/

# Don't change these lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1 [L]

# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder 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.)?yourmaindomain.com$ [NC]
RewriteRule ^(/)?$ subfolder/index.php [L]
* The above code is originally from Host Monster, but has been slightly modified to remove URL case sensitivity.

STEP 2:

Next, we must tell Joomla not to include the subfolder in the links it creates within its pages. (i.e. we want http://domain.com/index.php not http://domain.com/joomla1/index.php). We do this by editing the configuration.php file in the Joomla folder, and changing the $live_site variable as follows (NOTE: change domain.com to your actual domain):

Code:
var $live_site = 'http://www.domain.com';
Now, flush your browser cache and history, then try loading your site. If everything was done correctly you should see your site normally, and the URL will not contain the subfolder name.

Hope somebody finds this useful.

Cheers!

-Blitz.