Page 1 of 1

.htaccess redirect to sub-domains

Posted: Thu Mar 19, 2009 11:11 am
by alex.barylski
We have several folders in a web site like:

Code: Select all

domain.com/members
domain.com/register
domain.com/login
Currently these directories physically exist and simply have an .htaccess file in each one that does something like:

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} !^members\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{REQUEST_URI} ^/member($|/.*$)
RewriteRule ^.* http://members.domain.com%1 [R=permanent,L]
Is there any way to merge all of these directories .htaccess files into the single root .htaccess file?

Re: .htaccess redirect to sub-domains

Posted: Thu Mar 19, 2009 11:44 am
by LanceEh
You could try doing regex pattern matching, and then transpose that to the

http://%1.domain.com

I haven't done this for a subdomain so proceed at your own risk, this is only a guess!

Take care.