Limit Redirection to Content in the Destination Directory (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

By default, when you enable redirection, requests are served from the content directory that is specified for the destination, and from any subdirectories under that content directory. For example, if you configure the redirection destination to be, requests may be served from directories under /sales. However, you can limit requests to be served from only the content directory that is specified for the destination.


You must first enable redirection and configure the redirection destination. For more information about how to enable redirection and configure the destination, see Configure the Web Server to Redirect Requests to a Relative Destination (IIS 7).


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

  • None

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.

User Interface

To use the UI

  1. 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).

  2. In Features View, double-click HTTP Redirect.

  3. On the HTTP Redirect page, under Redirect Behavior, select Only redirect requests to content in this directory (not subdirectories).

  4. In the Actions pane, click Apply.

Command Line

To configure the content to come from only the specified destination directory, use the following syntax:

appcmd set config /section:httpRedirect /childOnly:true | false

By default, this attribute is false, but you specify true for the childOnly attribute. To do this, type the following at the command prompt, and then press ENTER:

appcmd set config /section:httpRedirect /childOnly:true

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).


The procedure in this topic affects the following configuration elements:

<childOnly> attribute of the <httpRedirect> element


Use the following WMI classes, methods, or properties to perform this procedure:

  • HttpRedirectSection.ChildOnly property

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.

See Also


Configuring HTTP Redirection in IIS 7