Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net IIS url重写角色(某些url除外)_Asp.net_Iis_Url Rewriting_Web Config - Fatal编程技术网

Asp.net IIS url重写角色(某些url除外)

Asp.net IIS url重写角色(某些url除外),asp.net,iis,url-rewriting,web-config,Asp.net,Iis,Url Rewriting,Web Config,我在URL重写中得到了这个规则,它使用HTTP到HTTPS将每个请求重写到站点 <rule name="Force HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCa

我在URL重写中得到了这个规则,它使用HTTP到HTTPS将每个请求重写到站点

<rule name="Force HTTPS" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
                </rule>

我需要这个角色中的另一个规则或异常来重写回特定的URL或将其重定向到HTTP


这可能吗?

您可以添加不希望重定向到HTTPS的异常作为额外条件(不等于该URL),如下所示:

<rule name="Force HTTPS" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        <add input="{REQUEST_URI}" negate="true" pattern="^/noredirect/forthis/page\.aspx$" ignoreCase="true" />
        <add input="{REQUEST_URI}" negate="true" pattern="^/noredirect/forthis/page-as-well\.aspx$" ignoreCase="true" />
        <add input="{REQUEST_URI}" negate="true" pattern="^/noredirect/forthis/page-as-well-too\.aspx$" ignoreCase="true" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>


将是这样的>>,?感谢回复,只要domain.com是您网站根目录中的一个目录,那么是的,就可以了。请注意,您应该在正则表达式中使用
domain\.com
来逐字匹配domain.com,否则dot将使正则表达式接受其中的任何字符。如果要将domain.com作为域名进行匹配,则不能使用此选项,因为
{REQUEST\u URI}
变量中不包含域名。我使用IIS向导从URL写入中排除特定域,结果在条件节点中创建了一行,如下所示:。SubStringOfURL是我要排除的URL的子字符串。请尝试从标记中删除
negate=“true”
。。。对meSo happy有用这是一件事。