【发布时间】:2013-03-21 17:06:17
【问题描述】:
假设我有一个应用,example.com.
一个客户可能在example.com/customer/hisname/拥有它的内容。
好吧,我想让客户为他的内容分配一个域,比如hisname.com,所以这个(hisdomain.com)呈现@987654324 @。
为此,我创建了两个虚拟主机,它们的根目录都在同一个位置,并且我编写了一个 .htaccess 文件以过滤 http_host,如果不是 example.com,则以这样的方式重写它将请求传递给 example.com/customer/hisname/。
尽管如此,当我没有得到 URI 中的 /customer/hisname/ 部分时,这种方法仍然不起作用。 如果我访问 example.com/index.php 中的 hisname.com/list/,我需要同时拥有 /list/ 和(作为前缀)/customer/hisname/,我只会得到,如您所料只是 /list/。
那么,什么是正确的方法呢?
【问题讨论】:
标签: php .htaccess mod-rewrite url-rewriting virtualhost