.htaccess规则:多个域到一个ssl域 [英] .htaccess rule: multiple domains to one ssl domain

查看:54
本文介绍了.htaccess规则:多个域到一个ssl域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试使以下内容工作2个小时.

I've tried around getting the following to work for 2 hours now.

我有多个域,例如: 测试版 Test.Abc.de Test.mmm.mm

I have multiple domains such as: Test.Xy.zz Test.Abc.de Test.mmm.mm

现在,只有Test.xy.zz获得了ssl证书,并且在其上运行的应用程序仅限于此证书.我想要所有非SSL请求-包括test.xy.zz和所有其他域都转到 https://test.xy .zz

Now only Test.xy.zz got an ssl certificate and the application running on it is limited to it. Therfor I want all non-ssl requests - including test.xy.zz and all other domains to go to https://test.xy.zz

希望有人可以提供帮助.

Hope someone can help.

可能的解决方案:

RewriteEngine On

RewriteCond %{HTTP_HOST} !test\.xy\.zz
RewriteRule ^(.*) https://test.xy.zz/$1 [QSA,R=301]

RewriteCond %{HTTPS} !on
RewriteRule ^(.*) https://test.xy.zz/$1 [QSA,R=301]

希望这对任何人都有帮助.

Hope this helps anyone.

推荐答案

 RewriteCond %{HTTPS} !on [OR]
 RewriteCond %{HTTP_HOST} !^test.xy.zz$
 RewriteRule (.*) https://test.xy.zz$1 [QSA,R=301]

这篇关于.htaccess规则:多个域到一个ssl域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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