> <VirtualHost 10.0.0.151:80>
> ServerName example.com
> ServerAlias *.example.com
>
> RewriteEngine on
>
> RewriteCond %{HTTP_HOST} .*\.example\.com
>
> RewriteRule ^(.*)\.example\.com(.*) http://$1.example2.com$2
>
> </VirtualHost>
>
> it doesn't seem to be working, though.
>
> Ideas?
Per-server RewriteRules are only matched against the part of the URL after
the domain name, so yours probably fails because it doesn't match the the
pattern you are using (the domain name).
Try something like this:
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com$
RewriteRule ^(.*)$ http://%1.example2.com$1
The %1 backreference matches the subdomain in the RewriteCond pattern.
The $1 backreference matches the full url in the RewriteRule pattern.
An [R] flag is unnecessary, since it is implicit in the substitution URL.
Haven't tested it, but something like that should work.
Jon
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list