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

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

问题描述

我们有一个使用Apache 2.2和Amp托管我们的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 .

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.

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

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.

谢谢

推荐答案

尝试以下操作:

 RewriteEngine On 

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

如果您同时为:80:443设置了<VirualHost>,则此重定向应同时在两种配置中进行.

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

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

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