URL rewrite parameters
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.
The full syntax of the action_parameters
field for a static rewrite URL rule that rewrites both the URI path and the query string is the following:
If you are only rewriting the URI path or the query string, omit the query
or path
parameter, respectively.
The full syntax of the action_parameters
field for a dynamic rewrite URL rule that rewrites both the URI path and the query string is the following:
If you are only rewriting the URI path or the query string, omit the query
or path
parameter, respectively.
The syntax of a dynamic rewrite URL rule that rewrites both the URI path and the query string based on wildcard matching and replacement is the following:
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.
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: