How to redirect multiple folders to the reflecting subdomain with .htaccess

Posted by helmi on Stack Overflow See other posts from Stack Overflow or by helmi
Published on 2010-04-30T09:12:04Z Indexed on 2010/04/30 9:47 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

Hi,

i tried redirecting some folders to the subdomains with the same names as the folders. I tried this way but it didn't work:

RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(test1|test2)(.*?)$ http://$1.domain.com$2 [R=301,L]

I guess the problem is that the alternation of folders doesn't return a result that i can get into $1, right?

I'm not a PCRE expert so andy help would be appreciated.

© Stack Overflow or respective owner

Related posts about pcre

Related posts about redirect