UrlRewriteFilter:www和https重定向
我正在使用Tuckey UrlRewriteFilter强制用户进入我的网站的"www"和"https"版本.我的意思是接下来的3个URL必须重定向到https://www.myweb.com
I am using Tuckey UrlRewriteFilter to force users to go to the 'www' and 'https' version of my web. I mean next 3 URLs must redirect to https://www.myweb.com
-
http://www.myweb.com
-
http://myweb.com
-
https://myweb.com
http://www.myweb.com
http://myweb.com
https://myweb.com
问题出在最后一个问题上,我找不到将"www"替换为"https"的解决方案.我有一个下一个规则,可以使2个第一种情况正常工作:
The problem comes with the last one, I cannot find the solution to put 'www' for 'https'. I have the next rule that makes 2 first cases work without problems:
<rule>
<name>Domain Name Check</name>
<condition name="host" operator="equal">myweb.com$</condition>
<condition type="scheme" operator="equal">^http$</condition>
<from>^(.*)$</from>
<to type="permanent-redirect">https://www.myweb.com$1</to>
</rule>
这当然不适用于第三种情况.如果我对第三种情况尝试类似的规则,如下所示,那么它也不起作用(我也不知道为什么):
This one of course does not apply for the third case. If I try a similar rule for the third case like the following, it doesn't work either (I don't know why):
<rule>
<name>Domain Name Check</name>
<condition name="host" operator="equal">myweb.com$</condition>
<condition type="scheme" operator="equal">^https$</condition>
<from>^(.*)$</from>
<to type="permanent-redirect">https://www.myweb.com$1</to>
</rule>
能否请您帮我弄清楚第三种情况的规则?
Could you please help me to figure out the rule for the third case?
谢谢.
问题不是过滤器,而是我的证书.我为www.myweb.com
颁发了证书,但没有为myweb.com
颁发证书,因此https://myweb.com
请求没有到达我的服务器,浏览器检测到该证书无效并阻止了该过程.
The problem was not the filter but my certificate. I issued my certificate for www.myweb.com
but not for myweb.com
so https://myweb.com
request didn't reach my server, the browser detected the certificate was not valid and blocked the process.
我刚刚为https://myweb.com
颁发了证书,并修改了我的Tuckey规则,如下所示.现在,https://www.myweb.com
是用户只能使用的URL.
I just issued my certificate for https://myweb.com
and modified my Tuckey rule as you can see below. Now https://www.myweb.com
is the only URL users can use.
<rule>
<name>Domain Name Check</name>
<condition type="request-url" operator="equal">(^http://myweb.com|^http://www.myweb.com|^https://myweb.com)</condition>
<from>^(.*)$</from>
<to type="redirect">https://www.myweb.com$1</to>
</rule>