I'm no re-write pro, but try something like:
Code:
RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 9
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.+) http://www.domain.com/mainpage [NE,L,R]
RewriteCond %{HTTP_HOST} ^www\.customer(.+)\.domain\.com$
RewriteCond %{HTTP_HOST} ^customer(.+)\.domain\.com$
RewriteRule ^(.+) http://www.domain.com/customers [NE,L,R]
Then you can have a look at the rewrite.log and figure the rest out.
Hope this helps.