RewriteEngine for subdomains?
Hi!I'm trying to host a few buddies on my web server, and I decided that rather than configuring apache for each vhost (as subdomains on worldhive.net), I'd go ahead and use mod_rewrite so that I can just create directories and automatically have them map to a web address.
For example, I want http://andrew.worldhive.net/ to automatically map to /htdocs/worldhive/users/andrew/...
The only problem (I think) is that I already run sites at several hardcoded vhost subdomains on worldhive.net, such as mail.worldhive.net, webmail.worldhive.net, www.worldhive.net.
I know mod_vhost_alias is out available, but I got the impression that it could only do really generic rewriting, not the isolated subdomain (on only one domain) vhosting I want.
Here is my set up right now that doesn't work:
<VirtualHost *>
ServerAdmin support@worldhive.net
DocumentRoot /usr/local/www/data/worldhive
ServerName worldhive.net
#ServerAlias www.worldhive.net
</VirtualHost>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]+\.worldhive\.net$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.worldhive\.net(.*) /htdocs/worldhive/users/$1$2
RewriteEngine off
</IfModule>
any ideas?
Do I have to have useCanonical off?
-Paul