通过通配符子域保留地址栏中的原始子域url

我怎样才能改变我的重写规则,以保持在地址栏中的原始子域的url?

目前,如果我input“username.domain.com”,它将被redirect到“domain.com/username”…,我希望地址栏留在“username.domain.com”。

我在我的httpd.conf文件中使用带有这个重写规则的通配符子域:

<IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC] RewriteRule ^(.*)$ http://domain.com/sites/%2 [L] </IfModule> 

这甚至有可能吗?

提前致谢。

如果您将最后一行更改为代理而不是redirect,我认为这会使您得到您想要的行为:

 RewriteRule ^(.*)$ http://domain.com/sites/%2 [P,L]