www.ourdomain.com
to automatically be taken to
www.ourdomain.com/forum
I know we could host the forum from the root and not use a sub-directory, but we actually want to have the sub directory as the root of our site.
At the moment our rewrite stuff (contained in an .htaccess in our root) reads:
- Code: Select all
Options +FollowSymLinks
# Turn on rewrites.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ourdomain.com [NC]
RewriteRule ^(.*)$ http://www.ourdomain.com/$1 [L,R=301]
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?ourdomain.com$
# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/forum/
# excluding requests for existing files
RewriteCond %{SCRIPT_FILENAME} !-f
# excluding requests for existing directories
RewriteCond %{SCRIPT_FILENAME} !-d
# redirect to the root of your website.
RewriteRule . /forum/? [R,L]
# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?ourdomain.com$
RewriteRule ^(/)?$ /forum/index.php [R=301]
This seems to work pretty well, but the problem is that Google (and other SEs) are looking for our robots.txt file in the root and because of the rewrite it throws up an error.
I was wondering what we should do? Is this the best way of hosting a site from a sub-directory? Can the robots.txt issue be fixed?
Thanks in advance.