【问题标题】:IIS Redirection - command lineIIS 重定向 - 命令行
【发布时间】:2011-06-07 14:49:22
【问题描述】:
我有一个网站说 www.mywebsite.com/demo 。每当有人请求此站点时,我想导航到另一个网站 www.myanotherwebsite.com 。我知道这可以通过使用 HTTP 重定向功能在 IIS 中完成。但由于我想为不同的网站执行此操作,我想编写一个 bat 文件,该文件将运行命令来设置网站的重定向 url。谁能帮我如何通过命令行设置重定向 URL?
编辑:我使用的是 IIS 7
【问题讨论】:
标签:
iis
powershell
iis-7
command-line
【解决方案1】:
看看这个 PowerShell 脚本
http://forums.iis.net/t/1162778.aspx
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\Default Web Site" -Value @{enabled="true";destination="domain.com";exactDestination="true";httpResponseStatus="Permanent"}