Modrewrite & Subdomains

They have: 92 posts

Joined: May 1999

Hello again,

I've got a question for all of you apache gurus (or wanna-be gurus like me). Basically, I'm trying to use subdomains for provide a user of my image gallery service with a subdomain.

Unlike normal subdomains, the redirect isn't to a folder but instead a url. As you can see from the following code, I want to take xxx.imageharbor.com and send the user to http://www.imageharbor.com?user=xxx

RewriteEngine on
RewriteCond       ${lowercase:%{HTTP_HOST}}       !^$
RewriteCond       ${lowercase:%{HTTP_HOST}}       !^www\.imageharbor.com$

RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.|)([^.]+)\.imageharbor\.com$
RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1       [C]
RewriteRule       ^(www\.|)([^.]+)\.imageharbor\.com(.*)       ?user=$2$3       [L]
'

(yes wildcards and rewrite is enabled)

Please let me know if you see anything I should change with this code or know of another way to do it thorugh apache (other rewrite code, mod_vhost_alias or what not). Thanks for the help!!!

Ted S