【发布时间】:2019-01-23 09:54:12
【问题描述】:
我一直致力于在 IIS 上编写一个添加 Url 重写条件的 powershell 脚本。这是一个示例代码。
Add-WebConfigurationProperty -pspath 'iis:\sites\Sample' -filter "system.webServer/rewrite/rules" -name "." -value @{name='Redirect www.google.com' ;patternSyntax='Regular Expressions' ;enabled='True' ;}
Set-WebConfigurationProperty -pspath $site -filter "$filterRoot/match" -name "url" -value "(^test/(.*)|^test($|/$))*"
$list = @{
pspath = 'MACHINE/WEBROOT/APPHOST/Sample'
filter = "/system.webServer/rewrite/rules/rule[@name='Redirect www.google.com']/conditions"
Value = @{
input = '{REMOTE_ADDR}'
matchType ='0'
pattern ='192.100.100.01'
ignoreCase ='True'
negate ='True'
},
@{
input = '{REMOTE_ADDR}'
matchType ='IsFile'
pattern ='192.100.100.01'
ignoreCase ='True'
negate ='True'
}
}
Add-WebConfiguration @list
在 $list 中,我想将 matchType 设置为“匹配模式”。这是我想要的 IIS 条件设置的相关匹配类型。设置这个需要的 matchType 是什么?
【问题讨论】:
标签: powershell iis