r2b2
11-12-2007, 03:21 AM
Ok, it's getting late and my brain is fried...
I've got an .htaccess file in place so that my main domain is served up from a subdirectory. Things work fine unless I'm requesting a directory and leave off the trailing slash.
What I want to happen is that if I request http://www.example.com/content it will end up requesting http://www.example.com/content/. However instead, it ends up requesting http://www.example.com/subdirectory/content/
Anyone know if there is a way around this or is it the base Apache config that's causing the problem?
I'm using the code supplied from the HostMonster helpdesk but I've put it below for ease of help - Note I have changed the relevant sections :D
# 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$
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1
# 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$
RewriteRule ^(/)?$ subfolder/index.php [L]
I've got an .htaccess file in place so that my main domain is served up from a subdirectory. Things work fine unless I'm requesting a directory and leave off the trailing slash.
What I want to happen is that if I request http://www.example.com/content it will end up requesting http://www.example.com/content/. However instead, it ends up requesting http://www.example.com/subdirectory/content/
Anyone know if there is a way around this or is it the base Apache config that's causing the problem?
I'm using the code supplied from the HostMonster helpdesk but I've put it below for ease of help - Note I have changed the relevant sections :D
# 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$
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1
# 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$
RewriteRule ^(/)?$ subfolder/index.php [L]