首页 > 其他分享 >iis的web.confg 中url重写与cros Configuring Inbound Rewrite Rules

iis的web.confg 中url重写与cros Configuring Inbound Rewrite Rules

时间:2023-03-10 14:14:58浏览次数:42  
标签:web Configuring iis Rewrite url cros Module Rules

最近有关注到web.config 配置,

有url 请求转发和跨域配置相关知识,

以下列出相关配置官网介绍:

Creating Rewrite Rules for the URL Rewrite Module | Microsoft Learn

<rewrite>
<rules>
<rule name="Fail bad requests">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
</conditions>
<action type="AbortRequest" />
</rule>
<rule name="Redirect from blog">
<match url="^blog/([_0-9a-z-]+)/([0-9]+)" />
<action type="Redirect" url="article/{R:2}/{R:1}" redirectType="Found" />
</rule>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&amp;title={R:2}" />
</rule>
</rules>
</rewrite>

 

 以下是配置跨域请求:

CORS Module Configuration Reference | Microsoft Learn

 

标签:web,Configuring,iis,Rewrite,url,cros,Module,Rules
From: https://www.cnblogs.com/davies/p/17203118.html

相关文章