使用IIS7 URL重写模块重定向到主.com域中其他域

问题描述:

如何配置IIS7的URL重写规则我aditional的域(domain.net,domain.org,domain.info)重定向到主.com域?

How should I configure the URL Rewrite Rule in IIS7 to redirect my aditional domains ( domain.net, domain.org, domain.info) to the principal .com domain?

在IIS7,您可以使用新的命令Appcmd.exe的启用重定向如下:

In IIS7, you can use the new command "appcmd.exe" to enable redirection as following:

%windir%\system32\inetsrv\appcmd set config "Default Web Site/" -section:system.webServer/httpRedirect -enabled:true -destination:"http://domain.com"

这告诉IIS重定向请求全部发送到虚拟应用程序/到 http://domain.com 。实际的结果是,Appcmd.exe的增加以下部分的web.config文件/:

This tells IIS to redirect all request sending to the virtual application "/" to "http://domain.com". The actual result is that appcmd.exe adds the following section to the web.config file for "/":

您domain.net的web.config文件

web.config of your domain.net

<system.webServer>

    <httpRedirect enabled="true" destination="http://domain.com" httpResponseStatus="Permanent"/>

</system.webServer>