Apache HTTPS 到 HTTPS 重定向 [英] Apache HTTPS to HTTPS Redirection

查看:36
本文介绍了Apache HTTPS 到 HTTPS 重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用 Apache 2.2 & 托管我们的 Web 应用程序的客户端服务器.RHEL 中的 Tomcat 6.我已经为 http 到 https 重定向设置了 apache 重写规则,它工作正常.我们有两个 DNS 名称用于访问同一个应用程序.Test1.com 和 Test2.com.我希望所有尝试访问 http://test1.com 或 https://test1.com 到 https://test2.com 的用户.如前所述,http://test1.com 到 https://test2.com 的重定向工作正常.我无法将 https://test1.com 实施到 https://test2.com.

我尝试过虚拟主机、ServerAlias、NameVirtualHost,但没有任何效果.如果我们可以通过重写来处理这个问题,任何建议都会有所帮助.任何其他可能导致解决此问题的指针将不胜感激.

谢谢

解决方案

尝试以下操作:

 RewriteEngine OnRewriteCond %{HTTP_HOST} test1.com$重写规则 ^(.*)$ https://test2.com$1 [L,NC,R=301]

如果您有 <VirualHost> 用于 :80:443,则此重定向应该在两种配置中进行.>

We have a client server hosting our web application using Apache 2.2 & Tomcat 6 in RHEL. I have setup apache re-write rule for http to https redirection and it works fine. We have two DNS names that are used to access the same application. Test1.com and Test2.com. I want all the users trying to access http:// test1.com or https:// test1.com to https:// test2.com. As mentioned, http:// test1.com to https:// test2.com redirection is working fine. I am not able to implement https://test1.com to https://test2.com.

I have tried Virtual Hosts, ServerAlias, NameVirtualHost, but nothing works. Any suggestions if we can handles this via re-write would help. Any other pointers that might lead to the resolution of this issue will be appreciated.

Thanks

解决方案

Try the following:

 RewriteEngine On 

 RewriteCond %{HTTP_HOST} test1.com$
 RewriteRule ^(.*)$ https://test2.com$1 [L,NC,R=301]

If you have a <VirualHost> for both :80 and :443, this redirect should go in both configurations.

这篇关于Apache HTTPS 到 HTTPS 重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆