Configure the Web Server to Redirect Requests to a Relative Destination (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
Enable redirection and configure the destination when you want clients to be redirected to a file, directory, or site. This is useful when your site is under construction or has changed identity.
The destination that you configure is a relative destination. For example, if you configure the redirection destination to be https://www.contoso.com/sales, and an incoming request is https://www.contoso.com/marketing/default.aspx, IIS redirects the request to https://www.contoso.com/sales/default.aspx.
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see HTTP Redirection Feature Requirements (IIS 7).
Exceptions to feature requirements
To enable redirection
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing the configuration files directly, or by writing WMI scripts.
To use the UI
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI based on your IIS administrative role, see Navigation in IIS Manager (IIS 7).
In Features View, double-click HTTP Redirect.
On the HTTP Redirect page, select Redirect requests to this destination. In the corresponding box, type the file name, directory path, or URL to which you want to redirect the user.
In the Actions pane, click Apply.
To enable or disable redirection, use the following syntax:
appcmd set config /section:httpRedirect /enabled:true|**false /destination:**location
By default, the redirection feature is disabled, but you can enable it by specifying true for the enabled attribute and configuring the location to which to redirect users in the destination attribute. For example, if you want to enable redirection and redirect users to https://www.contoso.com, type the following at the command prompt, and then press ENTER:
appcmd set config /section:httpRedirect /enabled:true /destination:https://www.contoso.com
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
The procedure in this topic affects the following configuration elements:
Use the following WMI classes, methods, or properties to perform this procedure:
For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.