RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]+.domain.com$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+).domain.com(.*) /index.php?subdomain=$1
But you don't need RewriteEngine for your task... just setup server so it would host *.domain.com and in your PHP scripts use something like that:

<?php
$subdomain = array_shift((explode(".",$_SERVER['HTTP_HOST']))); // will for example return "example" for "example.domain.com"
if($subdomain == 'example'){
do_something();
}else if($subdomain == 'new'){
do_something_new();
}
?>
Kaynak: https://stackoverflow.com/questions/...fake-subdomain