RewriteCond %{HTTP_HOST} ^([^\.]+)\.site\.ru$ [NC] RewriteCond %{HTTP_HOST} !^www\.site\.ru$ [NC] RewriteRule ^(.*)$ redir.php?us=%1 [L,QSA]