Rewrite Rule if Autosubdomain is *
If you create a Domain / Subdomain / Alias with Auto Subdomain "*" and use Rewrite Rules, the Condition only works for domain.tld, but not for www.domain.tld or test.domain.tld, because the Rewrite Rule uses ^domain.tld if you have no Auto Subdomain or * Subdomain. If you use "www" Auto Subdomain, it creates one Rule for ^domain.tld and one ^www.domain.tld and works fine for both.
If someone uses * Auto Subdomain, just use this RewriteCond/Rules to catch *.domain.tld and domain.tld for redirecting:
RewriteCond %{HTTP_HOST} ^([^.]+).domain.tld [NC] RewriteRule ^/(.*)$ TARGET [Flags]
RewriteCond %{HTTP_HOST} ^domain.tld [NC] RewriteRule ^/(.*)$ TARGET [Flags]
It took me long to see, that with Auto Subdomain * the subdomain www didn't redirect me cause of the rewrite rule and gone crazy, because without www (just domain.tld) the redirect worked fine :). Checked with auto subdomain www, and again worked for both, so i checked domain.vhost in /etc/apache2/sites-available/ and found the problem ;)