Apache .htaccess动态子域文件

Apache .htaccess动态子域文件,apache,.htaccess,Apache,.htaccess,这是我的.htaccess文件中的代码: RewriteCond %{HTTP_HOST} !^www\.domain\.com RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC] RewriteRule ^/?$ /user/profile.php?name=%1 [L] 它的作用如下: 如果我访问test.domain.com,它将显示domain.com/profile.php?name=test的内容(而不是重定向) 但是如果我键入:

这是我的
.htaccess
文件中的代码:

RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC]
RewriteRule ^/?$ /user/profile.php?name=%1 [L]
它的作用如下:

如果我访问
test.domain.com
,它将显示
domain.com/profile.php?name=test
的内容(而不是重定向)


但是如果我键入:
test.domain.com/login
,它将显示页面内容:
domain.com/login


问题:为什么?我怎样才能关闭它呢?谢谢

希望这能起作用,在我这方面效果很好

RewriteCond %{HTTP_HOST} !^www\.domain\.in
RewriteCond %{HTTP_HOST} ^test\.dmmain\.in [NC]
RewriteRule ^$ http://test.domain.in/user/profile.php [L,QSA]