$counter_aux=preg_match ( '/subdomain\.domainame\.com/' , $_SERVER['HTTP_HOST']); if($counter_aux<>0){ [whatever you want to do] }