简体   繁体   English

IIS7-URL重写问题

[英]IIS7 - URL Rewrite issue

I'm trying to rewrite some urls and i've done this in the past but for some reason it just won't stick this time. 我正在尝试重写一些url,而我过去已经这样做过,但是由于某种原因,这次它不会粘住。 Here's the rule: 这是规则:

    <rule name="Force HTTPS - Test.aspx" patternSyntax="ECMAScript" stopProcessing="true">
                            <match url="^Templates/Test\.aspx" />
                            <conditions>
                                <add input="{HTTP_HOST}" pattern="^my\.domain\.com$" />
                                <add input="{HTTPS}" pattern="^OFF$" />
                            </conditions>
                            <action type="Redirect" url="https://my.domain.com/Templates/test.aspx" />  
</rule>

It should be taking http://my.domain.com/Templates/test.aspx and redirecting to https ://my.domain.com/Templates/test.aspx. 它应该采用http://my.domain.com/Templates/test.aspx,然后重定向到https://my.domain.com/Templates/test.aspx

Unfortunately it's not working at all, no matter what i try.... 不幸的是,无论我尝试什么,它都根本不起作用。

I figured out that IIS was configured to force SSL on the files I tried redirecting. 我发现IIS配置为对尝试重定向的文件强制使用SSL。 That meant it would return an HTTP 403 error before even checking the url rewrite rules. 这意味着它甚至在检查url重写规则之前都会返回HTTP 403错误。

Hope that helps someone else. 希望对别人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM