Hey folks, i was wondering if someone could help me out with this. I figured out how to get it working on a per user basis in .htaccess, but I'd like to make a global rewrite rule so that users go to their appropriate http://user.domain.com addy.

This works in .htaccess, but I'd have to do this for everyone, and rely on the user to leave it alone:
RewriteBase /~user
RewriteRule ^(.*)$ http://user.domain.com/$1 [R]

Admittedly, I'm not the best at regex, but I thought this would work, and doesn't.
RewriteRule ^/~([^/])+/(.*)$ http://$1.domain.com/$2 [R]

What am I missing? Granted, the user will end up in the same directory as before, but I want their URL in the browser to change.

Also, I'd prefer if the domain would stay the same as the one they went to, say domain1.com/~user1 will be user1.domain1.com or domain2.com/~user1 to user1.domain2.com

Thanks for any help you can give me.