虚拟主机映射到目录结构
我已经阅读了 apache 上的大量虚拟主机帮助,但作为一个相对新手,我有点困惑。我知道我的问题必须是可以实现的,因为这是一个非常基本的问题,但我迷失了...
基本上我有很多虚拟主机指向我的服务器,并且它们指向其 DocumentRoot 的文件结构是一致的...例如。
www.mydomain.com -> /home/blah/vhosts/mydomain.com/www/public
abc.mydomain.com -> /home/blah/vhosts/mydomain.com/abc/public
www.another.co.uk -> /home/blah/vhosts/another.co.uk/www/public
def.another.co.uk -> /home/blah/vhosts/another.co.uk/def/public
如果可能,我还需要将非 www.* 重定向到 www.*,但要考虑到子域的可能性,以便:
mydomain.com
重定向到www.mydomain。 com
abc.mydomain.com
NOT 按原样重定向到www.mydomain.com
使用上面的定义处理(由于目录结构)
这可能吗?
I have read the mass virtual host help on apache but as a relative newbie I am left a little confused. I know my problem must be acheiveable as it is a pretty basic problem but i am lost...
Basically I have lots of virtual hosts pointing to my server and the file structure that they point to for their DocumentRoot is consistent... e.g..
www.mydomain.com -> /home/blah/vhosts/mydomain.com/www/public
abc.mydomain.com -> /home/blah/vhosts/mydomain.com/abc/public
www.another.co.uk -> /home/blah/vhosts/another.co.uk/www/public
def.another.co.uk -> /home/blah/vhosts/another.co.uk/def/public
If possible, I also need to redirect non-www.* to www.* but taking into account the possibility of a subdomain, so that:
mydomain.com
is redirected towww.mydomain.com
abc.mydomain.com
is NOT redirected towww.mydomain.com
as it is
handled with the definition above (due to directory structure)
Is this at all possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我对所有虚拟主机所做的操作:我正在使用 Apache writemap。
与合作伙伴创建一个新的“partner.txt”文件,如下所示:
然后编译它,并将其添加到重写规则中以查明前缀是否是合作伙伴,如下所示:
Here what I do for all my vhosts: I'm using Apache writemap.
Create a new "partner.txt" file with partners like this:
Then compile it, and add use it into your rewriterules to find out whether the prefix is a partner or not, like this: