重定向流量

时间:2011-04-09 18:30:51

标签: apache mod-rewrite apache2 vhosts

我想以这种方式重定向流量。

kevin.domain.com -> /var/www/kevin/domain.com/
thomas.example.com -> /var/www/thomas/domain.com/
kevin.subdomain.domain.com -> /var/www/kevin/subdomain.domain.com/
$user.$subdomain-and-domain -> /var/www/$user/$subdomain-and-domain/

但如果第一部分不是用户(也就是说,/var/www/$user/不存在),则必须以这种方式重定向:

domain.com -> /var/www/working/domain.com/
subdomain.example.nl -> /var/www/working/subdomain.example.nl/
$domain -> /var/www/working/$domain/

我怎么能达到这个目的?

非常感谢:D!

2 个答案:

答案 0 :(得分:0)

您可以通过配置虚拟主机或使用mod_rewrite来实现。

看看这里:http://httpd.apache.org/docs/2.0/vhosts/mass.html

解释了这两种方法。如果您在实施它时遇到任何问题,请回来。

答案 1 :(得分:0)

也许mod_userdir很有趣。