Though, if you want every query in the form of index.php?product= to be redirected to the subdomain, htaccess is your best choice. If you have it enabled, use it over PHP if at all possible since the rules in it are executed before PHP parses and runs any scripts. What you are looking for can be done with:
EDIT: DaniWeb bug above? I set the code type in the above tag to htaccess. Are unknown types being defaulted to PHP or is there some kind of language detector (if so, .ht files look nothing like PHP source)?