Compartir a través de


httpRedirect Element [IIS Settings Schema]

Note

For more information about the httpRedirect element, see the following topic on the Microsoft IIS.net Web site: HTTP Redirects <httpRedirect>.

Configures settings for redirecting client requests to a new location.

Syntax

Attributes and Elements

The following sections describe attributes, child elements, and parent elements for this section.

Attributes

Attribute

Description

childOnly

Optional Boolean attribute.

Specifies whether the destination value should be added to the beginning of the file name that contains the request to be redirected. For example, if childOnly were set to true and the destination value were configured to be http://marking.contoso.com/, a request for https://contoso.com/default.htm would be redirected to http://marketing.contoso.com/default.htm.

The default value is false.

destination

Optional string attribute.

Specifies a URL or virtual path to which to redirect the client.

enabled

Optional Boolean attribute.

Specifies whether redirection is enabled (true) or disabled (false).

The default value is false.

exactDestination

Optional Boolean attribute.

Specifies that the destination value should be considered an absolute target location, not a relative location.

The default value is false.

httpResponseStatus

Optional enum attribute.

Specifies type of redirection.

The httpResponseStatus attribute can be one of the following possible values. The default is Found.

ValueDescription
FoundReturns a 302 status code, which tells the client to issue a new request to the location specified in the destination attribute. The numeric value is 302.
PermanentReturns a 301 status code, which informs the client that the location for the requested resource has permanently changed. The numeric value is 301.
TemporaryReturns a 307 status code, which prevents the client from losing data when the browser issues an HTTP POST request. The numeric value is 307.

Child Elements

Element

Description

add

Optional element.

Adds a wildcard redirection rule to the collection of redirection rules.

clear

Optional element.

Removes all references to wildcard redirection rules from the collection of redirection rules.

remove

Optional element.

Removes a reference to a wildcard redirection rule from the collection of redirection rules.

Parent Elements

Element

Description

configuration

Specifies the root element in every configuration file that is used by IIS 7.

system.webServer

Specifies the top-level section group (in ApplicationHost.config) in which this element is defined.

Remarks

For more information about the httpRedirect element, see the following topic on the Microsoft IIS.net Web site: HTTP Redirects <httpRedirect>.

Element Information

Configuration locations

Machine.config

ApplicationHost.config

Root application Web.config

Application Web.config

Directory Web.config

Requirements

Microsoft Internet Information Services (IIS) version 7.0

See Also

Reference

add Element for httpRedirect [IIS Settings Schema]

remove Element for httpRedirect [IIS Settings Schema]

clear Element for httpRedirect [IIS Settings Schema]