Apache 2.4 整个 URL 重写 https



>我的服务器上有一个 Apache 2.4 配置,可以通过 dns 条目访问alpha.site.com 和 beta.site.com

我希望 alpha.site.com 无缝重定向到文档根目录/this并 beta.site.com 无缝重定向到文档根目录/那

我怀疑这是通过使用httpd.conf中的Apache重写规则来完成的,例如像这样的东西

RewriteEngine  on
RewriteRule  "^https://alpha.site.com$" "https://alpha.site.com/this" [PT]

这似乎不起作用。关于如何使其工作,有什么见解吗?

最终采用不同的途径通过使用别名指令来解决此问题,每个 URL 一个。

<VirtualHost _default_:443>
ServerName alpha.site.com
Alias "/" "/this/"
</VirtualHost>

<VirtualHost _default_:443>
ServerName beta.site.com
Alias "/" "/that/"
</VirtualHost>

最新更新