I have been struggling with this problem on hostgator shared hosting server for the past 3 hours. This is the problem in the simplest

This is the mapping i want to happen: subdomain.domain.comwww.domain.com/test.php?user=subdomain
but for some reason whenever i enter "subdomain.domain.com" the redirection doesn't happen and even the URL doesn't change in my browser. And I see test.php file listed on loaded page (because The only files i have on server are .htaccess and test.php)

This is the .htacess code
 RewriteEngine On RewriteBase /  RewriteCond %{HTTP_HOST} !^www. [NC] RewriteCond %{HTTP_HOST} a-z0-9domain.com [NC] RewriteRulehttpwww.domain.com/test.php?user=$1$2 [P,L]   RewriteCond %{HTTP_HOST} !^www. [NC] RewriteCond %{HTTP_HOST} a-z0-9domain.com [NC] RewriteRulehttpwww.domain.com/test.php?user=$1$2 [R=301,L]  
and this is the test.php code

does anyone know what the issue here is? the support was not helpful to me. i think there is something wrong with the server configuration.