I'm trying to do something like VirtualHosts using mod_rewrite on a GoDaddy hosted site. I have a single hosting account and two domains, a.com and b.com. I want requests for b.com/document.html to be served from ~/html/b_site/document.html (where ~/html/ is the DocumentRoot, serving as root for a.com). I found a reference to this use case in the mod_rewrite documentation suggesting that it is possible, but I've been unsuccessful. Here's the contents of ~/html/.htaccess:
RewriteEngine on
Options FollowSymLinks
RewriteCond %{HTTP_HOST} b\.com$
RewriteBase /
RewriteRule ^(.*)$ b_site$1
The result, when I point my browser at b.com: the location bar changes to b.com/b_site/ and the server responds with 500. The following RewriteRule works without any issues:
RewriteRule ^(.*)$ b_site/index.html
...which remains the only way I've been able to get anything but a 500 or warnings about redirect loops. The RewriteBase line seems to make no difference.
To find out what was being matched, I wrote a simple PHP script which would accept a query parameter and print it, and I used this RewriteRule:
RewriteRule ^(.*)$ b_site/index.php?q=$1
The output shows that in this case the RewriteRule matched "b_site/index.php". The RewriteBase documentation does imply that something like that should be happening, but again, the RewriteBase seems to make no difference in the result. Answers posed to similar questions all seem to boil down to the same mechanism that I'm trying.
Any thoughts?