Url通过appcmd重写

use*_*794 0 url-rewriting appcmd

我想使用appcmd创建urlrewrite url以重定向来自的所有请求

HTTP://

https://开头

我试图谷歌但没有找到.你能给我一些基本的例子吗?

use*_*794 5

得到它的工作:

appcmd.exe set config -section:system.webServer/rewrite/rules /+"[name='http_redirect',enabled='True']" /commit:apphost

appcmd.exe set config -section:system.webServer/rewrite/rules.[name='http_redirect'] /match.url:"(.*)" /match.ignoreCase:true /commit:apphost

appcmd.exe set config -section:system.webServer/rewrite/rules.[name='http_redirect'].conditions/add /+"[input='{HTTPS}',pattern='off']" /commit:apphost

appcmd.exe set config -section:system.webServer/rewrite/rules.[name='http_redirect'].action /+"[type='Redirect',url='https://{HOST_NAME}/{R:1}',redirectType='Found']" /commit:apphost
Run Code Online (Sandbox Code Playgroud)

链接可以帮助构建appcmd脚本.