I would say that you could simplify your condition since you only need it to start with mail. as opposed to finishing with something, so perhaps:
I am not clear if you are getting errors with what you have?
Ok, I think you can use something like the example here:
http://httpd.apache.org/docs/2.2/rewrite/r...html#uservhosts
By using 2 rewrite_rules, the first adds the host name to the front of the full address that is then used in the second rule.
I usually point my sites that require email to Google Apps. I've added CNAME records to the DNS to point mail, docs, and calendar appropriately, but I also want to have a wildcard subdomain match so that all subdomains are sent to my VPS and handled there (this way I don't have to add a record for each subdomain that I may create). I'm using VirtualDocumentRoot so that I can map any subdomain to a domain instantly by adding a folder, without ever having to touch my apache config. I could create an .htaccess file to redirect accordingly, but I'd have to do this for every single domain that I have now and any I add in the future; it's a tedious solution to say the least.
What I want is to capture any mail, docs, or calendar subdomain and rewrite or redirect them to the proper Google App page. I can't seem to figure out how my rule needs to be written. My condition appears to be working, but I have a feeling even that could be wrong since I tested it against a simple expression and had nothing after my domain name:
RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,L]
Any ideas? Thanks.
Who can bring a charge to God's elect? It is God who justifies!