Wildcard Subdomains, .htacess, and multiple variables

Simple!

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\\.)?([^\\.]+)\\.example\\.com$ [NC]
RewriteRule ^$ /index.php?var=%2 [L]

[B]RewriteCond %{HTTP_HOST} ^(www\\.)?([^\\.]+)\\.example\\.com$ [NC]
RewriteRule ^(.*)$ /index.php?var=%2&id=$1 [L][/B]
# BECAUSE (.*) will match index.php,
# change (.*) to ([a-zA-Z]+) or
# ANY character range definition
# without a dot character else
# add another RewriteCond to exclude
# index.php from the {REQUEST_URI}

Easy enough for you?

Regards,

DK