【发布时间】:2011-07-28 04:42:38
【问题描述】:
我有一个问题想看看是否有可能,因为我的搜索结果是空的,或者同一个博客讲述的内容完全不同......
基本上,我已将 *.mydomain.com 的 A 记录添加到我的 IP...好吧,简单的事情结束了。
现在我创建了一个类似的 VirtualHost:
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias *.mydomain.com
DocumentRoot /home/sites/mydomain.com/htdocs
</VirtualHost>
现在,如果我希望它们都指向 index.php 页面,以上内容就可以了。但是我想要一个更复杂的 VirtualHost...
链接看起来像这样:
http://someusername.mydomain.com/public/repositoryname
这将指向类似以下内容:
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias *.mydomain.com
<Location /home/svn/{someusername}/{public}/{repositoryname}>
#Some more code in here...
</Location>
</VirtualHost>
显然是位置变量:
{someusername} - Will be what the subdomain is
{public} - Will be the first GET parameter from the url query string
{repositoryname} - Will be the second GET paramter from the url query string
现在我知道这可能会使 Apache WildCards 达到极限,但我需要知道这是否可以实现。
非常感谢, 肖恩
【问题讨论】:
标签: apache2 virtualhost