PingAccess

Adding rewrite URL rules

Add a rewrite URL rule, which examines the URL of every request and determines if a pattern matches, in PingAccess.

Before you begin

Confirm that you are not using the agent model. Rewrite URL rules aren’t available for agent deployments.

About this task

When you define a regular expression in a rule (such as regex), and if a pattern matches, PingAccess uses the information configured in the rewrite URL rule and rewrites that portion of the Uniform Resource Locator (URL) into a path that the site can understand.

To add a rewrite URL rule:

Steps

  1. Click Access and then go to Rules → Rules.

  2. Click Add Rule.

  3. In the Name field, enter a unique name for the rule up to 64 characters.

    Special characters and spaces are allowed.

  4. In the Type list, select Rewrite URL.

  5. In the Map From field, enter the regex of the URL path and the query you want to match.

    Example:

    [.codeph]``^/bank/(.*)``

    This example illustrates matching the Request-Line in the request. The Request-Line begins with /bank/ (the ^ indicates "begins with") and places the rest of the URL into the first capture group.

    For more information on regex patterns, see the Oracle Java Docs.

  6. In the Map To field, enter the URL path and the query that you want to generate.

    Example:

    [.codeph]``/application/$1``

    This example defines the replacement string, which generates / followed by the content of the first capture group.

    To better understand the use of special characters, such as \ and $, in the replacement string, see the .oracle.com/javase/6/docs/api/java/util/regex/Matcher.html//[Oracle Java Docs].

  7. Click Save.

Rewrite URL rule configuration examples

This table displays four examples of rewrite URL rule configurations in PingAccess.

Map from value Map to value Example request Rewrite by PingAccess

/bank/

/application/

/bank/content.html

/application/content.html

^/bank/(.*)

/application/$1

/bank/content.html

/application/content.html

/bank/index.html

/application/index.jsp

/bank/index.html

/application/index.jsp

/bank/index.html

/application/index.jsp

/bank/index.html?query=stuff

/application/index.jsp?query=stuff