简体   繁体   English

Apache 2.4整个URL重写https

[英]Apache 2.4 whole URL rewrite https

I have an Apache 2.4 configuration on my server, which is reached via the dns entries alpha.site.com and beta.site.com 我的服务器上有一个Apache 2.4配置,可通过dns条目alpha.site.com和beta.site.com进行访问

I want the alpha.site.com to redirect seamlessly to the document root /this and beta.site.com to redirect seamlessly to the document root /that 我希望alpha.site.com无缝地重定向到文档根目录/ this和beta.site.com无缝地重定向到文档根目录/ that

I suspect that this is done by using the rewrite rules of Apache in httpd.conf, eg something like this 我怀疑这是通过使用httpd.conf中的Apache重写规则完成的,例如这样的事情

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

which doesn't seem to work. 这似乎不起作用。 Are there any insights on how to make it work? 关于如何使其工作有什么见解?

Ended up following a different route to solve this by using Alias directives, one for each URL. 最终通过使用Alias指令(每个URL一个)来解决此问题。

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

and

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM