Configuring Action Types

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

A rewrite rule action is performed when there is a successful match of a rule pattern and a condition in the current URL. There are several types of actions available. You can use the <action> configuration element type attribute to specify the action the rule will perform. Each of the following action types and their configuration options are described in the sections that follow.

  • Rewrite

  • Redirect

  • CustomResponse

  • AbortRequest

  • None

Rewrite action

The rewrite action replaces the current URL string with a substitution string. The substitution string must always specify a URL path (for example, contoso/test/default.aspx). IIS does not support substitution strings that refer to a physical path on a file system (for example, C:\inetpub\wwwroot). Rewrite actions have the following configuration options.

Rewrite Action Property Attribute Description

Rewrite URL

url

Specifies a substitution URL that is either a relative URL path (for example, contoso/test/default.aspx) or an absolute URI (for example, https://example.com/contoso/test/default.aspx). This substitution URL can include back references and server variables. For more information about back references, see Using Back References. For more information about server variables, see Using Server Variables.

Append query string

appendQueryString

Specifies whether the query string from the original URL will be appended to the substituted URL. The default is true.

Stop processing of subsequent rules

stopProcessing

Specifies that when the rule matches, the URL produced by the rule will be passed to the IIS request pipeline, and subsequent rules will not be processed. The default is false.

Redirect action

Redirect action tells the URL Rewrite module to send a redirect response back to the client. The redirect status code (3xx) can be specified as a parameter for this action. The Location field of the response will contain the substitution string that was specified in the rule. Usage of Redirect action implies that no subsequent rules will be evaluated for the current URL after redirection is performed. Redirect actions have the following configuration options.

Redirect Action Property Attribute Description

Redirect URL

url

Specifies a substitution URL that is either a relative URL path (for example, contoso/test/default.aspx) or an absolute URI (for example, https://example.com/contoso/test/default.aspx). The substitution URL can include back references and server variables. For more information about back references, see Using Back References. For more information about server variables, see Using Server Variables.

Append query string

appendQueryString

Specifies whether the query string from the original URL will be appended to the substituted URL. The default is true.

Redirect type

redirectType

Specifies the status code to return during the redirect. Possible values with their corresponding status codes are Permanent (301), Found (302), SeeOther (303), or Temporary (307). The default is Temporary.

CustomResponse action

A CustomResponse action responds to an HTTP client request by using a status code, a subcode, and a reason that you specify. No subsequent rules are evaluated for the URL after a custom response action is performed. Custom response actions have the following configuration options.

CustomResponse Action Property Attribute Description

Status code

statusCode

The status code to use in response to the client.

Substatus code

subStatusCode

The substatus code to use in response to the client.

Reason

statusReason

The reason phrase to use with the status code.

Error description

statusDescription

The one-line description to put in the body of the response.

AbortRequest action

The abort request action causes the URL Rewrite module to drop the HTTP connection for the current request. The action does not have any parameters. Usage of this action implies that no subsequent rules will be evaluated for the current URL after this action is performed.

The None action

The none action is used to specify that no action should be performed.

See Also

Concepts

Edit Inbound Rule Page
Edit Outbound Rule Page