---
title: Adding rewrite URL rules
description: Add a rewrite URL rule, which examines the URL of every request and determines if a pattern matches in PingAccess.
component: pingaccess
version: 9.0
page_id: pingaccess:pingaccess_user_interface_reference_guide:pa_adding_rewrite_url_rules
canonical_url: https://docs.pingidentity.com/pingaccess/9.0/pingaccess_user_interface_reference_guide/pa_adding_rewrite_url_rules.html
revdate: October 7, 2025
section_ids:
  before-you-begin: Before you begin
  steps: Steps
  example: Example:
  example-2: Example:
  rewrite-url-rule-configuration-examples: Rewrite URL rule configuration examples
---

# Adding rewrite URL rules

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

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) *(tooltip: \<div class="paragraph">
\<p>Identifies a resource according to its internet location.\</p>
\</div>)* into a path that the site can understand.

## Before you begin

Confirm that you aren't using the [agent](../introduction_to_pingaccess/pa_choose_a_deployment_model.html#agent) model. Rewrite URL rules aren't available for agent deployments.

## Steps

1. Click **Access**, then go to **Rules > Rules**.

2. Click **[icon: plus, set=fa]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:

   `^/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.

   You can find more information on `regex` patterns in the [Oracle Java Docs](http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html).

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

   ### Example:

   `/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, refer to the [Oracle Java Docs](http://docs.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html#replaceAll).

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` |
