Stuff
public text v1 · immutableRewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://foo.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteRule ^(.*)$ http://foo.example.com/$1 [R=301,L]