Tomcat URL使用多个域和SSL重写

时间:2014-10-11 22:06:53

标签: tomcat url-rewriting

我的tomcat 7配置有问题;我之前使用tuckey URL Rewrite库使用此配置将非www和非https流量重定向到https + www URL:

<rule>
  <name>Canonical Hostnames</name>
  <condition name="host" operator="notequal">^www.mydomain.net</condition>
  <condition name="host" operator="notequal">^$</condition>
  <from>^/(.*)</from>
  <to type="permanent-redirect" last="true">https://www.mydomain.net/$1</to>
</rule>

我刚购买了域名的.com版本;并已成功为其设置SSL证书。我将上面的配置更改为使用.com网址代替&amp;现在我希望所有.net流量,非www和非https都重定向到https + www + .com url。目前,当我访问我的网站的.net版本时,它不会重定向到.com&amp;我在浏览器中看到一个ssl证书错误,因为很明显该站点设置为使用.com ssl证书。

任何帮助都会非常感激 - 我并没有把tuckey作为解决方案。 感谢

1 个答案:

答案 0 :(得分:0)

<rule>
  <name>Canonical Hostnames</name>
  <condition name="host" operator="notequal">^www.example.com</condition>
  <condition name="host" operator="notequal">^$</condition>
  <from>^/(.*)</from>
  <to type="permanent-redirect" last="true">https://www.example.com/$1</to>
</rule>

你应该......只需将.net更改为.com即可。现在任何不是www.mydomain.com的东西都会成为它。

相关问题