Show TOC

Procedure documentationRewriting URLs Locate this document in the navigation structure

 

With the operations RegRewriteUrl and RegIRewriteUrl (case insensitive pattern match) you can rewrite a URL before the request is sent to the application server.

Procedure

Use the operations in the action file. You can find a description of the syntax under Manipulating URLs.

The rewrite actions are executed in the order they appear in the action file.

You can make further specifications for redirects using Conditions: Redirect can be restricted to specific clients, protocols, and times.

You can select the following options to control the rewrite process:

  • noescape: noescape: By default the result of the rewrite is URL coded (special characters substituted: '%', '/', '&'). If this option is selected, the result is not URL-coded.

  • restart: Restarts the first rewrite action. Rewrites already executed remain valid.

  • break; Subsequent rewrites in the action file are not executed.

  • compound: With this option multiple rules can be grouped in a block. Each of the actions specified with the compound option belongs to one block. If the URL does not match the regular expression of an action, the subsequent actions of this block are no longer executed. If the URL does match the pattern of a rule, this option has no affect.

  • skip: If the URL matches the pattern of an action, this options means that the next <n> actions are to be skipped.

Handling the Query String

The query string consists of all the characters following the "?" in the URL:

Example Example

Beim Request "/sap/xi/send?client=100&sap-language=de&keep_context" ist der Querystring "client=100&sap-language=de&keep_context".

End of the example.

The standard behavior is that the query string substitutes a query string generated from the request with the rewritten URL. If the rewritten URL contains a query string, this is substituted.

With the options qsreplace and qsappend you can control what the handler does with the original query string and, if applicable, with the generated query string.

Option qsreplace

If the option qsreplace is set, the original query string is always replaced with the new query string.

Option qsappend

If the option qsappend is set, the new query string is always appended to the original query string.

Example

The table below shows the affect of actions (rules in the action file) on selected requests.

Rule (line in the action file)

Request Before

Request After

RegRewriteUrl ^/ping(.*) /sap/public/icman/ping$1

/ping/info

/sap/public/icman/ping/info

RegIRewriteUrl ^/echo(.*) /sap/bc/echo?header=1

/echo

/sap/bc/echo

/echo?client=100

/sap/bc/echo?client=100

RegIRewriteUrl ^/echo(.*) /sap/bc/echo?header=1 [qsreplace]

/echo

/sap/bc/echo?header=1

/echo?client=100

/sap/bc/echo?header=1

RegIRewriteUrl ^/echo(.*) /sap/bc/echo?header=1 [qsappend]

/echo

/sap/bc/echo?header=1

/echo?client=100

/sap/bc/echo?client=100&header=1