警告:我不是Apache 专家或受过培训或交易的网站管理员(C++ 开发人员),所以我认为这是一个相当明显的新手级问题。提前道歉。
我需要一个 Apache 2.x 重写规则,它将请求的域作为子域映射到我们的域中。
简化示例:
domain1.com/index.php?option=80 -> domain1.masterdomain.com/index.php?option=80
www.domain1.com/index.php?option=99 -> domain1.masterdomain.com/index.php?option=99
domain2.com/index.php?option=33 -> domain2.masterdomain.com/index.php?option=33
www.domain2.com/index.php?option=44 -> domain2.masterdomain.com/index.php?option=44
我尝试了各种建议的选项,但到目前为止,没有任何乐趣。最近的尝试是:
RewriteRule ([^.]+)\.com(.*) http://$1.masterdomain.com [L]
注意:这存在于一个虚拟主机中,该主机在特定 IP 上拥有端口 80,因此我可以看到 VHost 中没有其他有趣的事情对此有任何影响。
我相信我的问题都在我的正则表达式中,但老实说,它在逃避我。
任何援助都会非常感激。我一直在研究 Apache 文档和我能找到的所有谷歌提示,但我只是没有看到它。
谢谢~