URL rewrite parameters

Last updated May 5, 2026 Static and dynamic URL rewrites have different parameters:

  • A static URL rewrite requires a static value for the target URL.
  • A dynamic URL rewrite requires an expression that, when evaluated, will define the target URL.

A URL rewrite with wildcard patterns is a simplified interface in the Cloudflare dashboard for creating dynamic URL rewrites with wildcard matching and replacement.

The maximum length of all parameter values in a URL rewrite (combined) is 4,096 characters. For example, you could provide a static value (or an expression) for the URI path with 2,048 characters and a static value (or expression) for the query string with 2,048 characters.

API information

Static URL rewrites

The full syntax of the action_parameters field for a static URL rewrite rule that rewrites both the URI path and the query string is the following:

"action_parameters": {
  "uri": {
    "path": {
      "value": "<URI_PATH_VALUE>"
    },
    "query": {
      "value": "<QUERY_STRING_VALUE>"
    }
  }
}

If you are only rewriting the URI path or the query string, omit the query or path parameter, respectively.

Dynamic URL rewrites

The full syntax of the action_parameters field for a dynamic URL rewrite rule that rewrites both the URI path and the query string is the following:

"action_parameters": {
  "uri": {
    "path": {
      "expression": "<URI_PATH_EXPRESSION>"
    },
    "query": {
      "expression": "<QUERY_STRING_EXPRESSION>"
    }
  }
}

If you are only rewriting the URI path or the query string, omit the query or path parameter, respectively.

Wildcard matching and replacement

The syntax of a dynamic URL rewrite rule that rewrites both the URI path and the query string based on wildcard matching and replacement is the following:

{
    "expression": "(http.request.full_uri wildcard r\"<REQUEST_URL>\")",
    "action_parameters": {
        "uri": {
            "path": {
                "expression": "wildcard_replace(http.request.uri.path, r\"<PATH_TARGET_PATH>\", r\"<PATH_REWRITE_TO>\")"
            },
            "query": {
                "expression": "wildcard_replace(http.request.uri.query, r\"<QUERY_TARGET_QUERY>\", r\"<QUERY_REWRITE_TO>\")"
            }
        }
    },
    "action": "rewrite"
    // ...
}

The <REQUEST_URL>, <PATH_TARGET_PATH>, <PATH_REWRITE_TO>, <QUERY_TARGET_QUERY>, and <QUERY_REWRITE_TO> value placeholders correspond to the fields available in the Cloudflare dashboard when you select the Wildcard pattern option. For more information, refer to Wildcard pattern parameters.

Note

The http.request.uri.query field does not include the ? delimiter at the beginning, which means that your <QUERY_TARGET_QUERY> value should not try to match an initial ?.

Different URL rewrite types in the same rule

The same rule can have different types of URL rewrites for the URI path and the query string. For example, a single rule can perform a dynamic URL rewrite of the URI path and a static URL rewrite of the query string. The syntax of such a rule would be the following:

"action_parameters": {
  "uri": {
    "path": {
      "expression": "<URI_PATH_EXPRESSION>"
    },
    "query": {
      "value": "<QUERY_STRING_VALUE>"
    }
  }
}

Was this helpful?

YesNo

On this page

URL rewrite parameters - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/rules/transform/url-rewrite/reference/parameters/#page","headline":"URL rewrite parameters","description":"Configurable parameters for URL rewrite rules.","url":"https://developers.cloudflare.com/rules/transform/url-rewrite/reference/parameters/","inLanguage":"en","image":"https://developers.cloudflare.com/rules/transform/url-rewrite/reference/parameters/og.png?v=7f52e9740c26f8de","dateModified":"2026-05-05","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["URL rewrite"]}


description: Redirect visitors to different URLs with Single Redirects and Bulk Redirects. title: Redirects image: https://developers.cloudflare.com/rules/url-forwarding/og.png?v=a9d28067c0d5afbc


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/rules/llms.txt
Use this file to discover all available pages before exploring further.