Here's some new code based on the updated information. This worked in my testing environment.
RewriteBase /v/
RewriteCond %{HTTP_HOST} ^(www\.)?my-domain\.com$
RewriteCond %{QUERY_STRING} ^vid=(.*)$
RewriteRule ^(index.php)?$ http://v.my-domain.com/%1 [R=301,L]
There are still a few assumptions, so you may need to tweak it a bit if there are edge cases you didn't mention. For example, this snippet:
- Requires the query string to always be present
- Expects no other query variable but vid to be present
- Actually doing a redirect instead of rewrite - you can take out the R=301, to change that.
Sources:
- Subfolder to Subdomain
- Query Strings in Rewrites
- Domain Name in Rewrites