Create a URL rewrite rule in the dashboard

Last updated May 5, 2026 Refer to the Rules examples gallery for examples of rule definitions.

To create a rule:

  1. In the Cloudflare dashboard, go to the Rules Overview page. Go to Overview ↗
  2. Select Create rule > URL Rewrite Rule.
  3. (Optional) Select one of the rule templates that address common use cases. Then, review and adjust the proposed rule configuration.
  4. Enter a descriptive name for the rule in Rule name.The URL rewrite rule creation page in the Cloudflare dashboard.
  5. Under If incoming requests match, select one of the following options:
  6. Wildcard pattern: The rule will only apply to traffic matching the wildcard pattern in Request URL. Refer to Wildcard pattern parameters for details.
  7. Custom filter expression: The rule will only apply to traffic matching a custom expression. Define the rule expression to configure which requests should be rewritten. Use either the Expression Builder or the Expression Editor to define the custom expression. For more information, refer to Edit expressions in the dashboard.

    Note

    Check the fields and functions you can use in filter expressions of URL rewrite rules. - All incoming requests: The rule will apply to all traffic. 6. (Optional) Define the action for your URL rewrite rule by selecting one of the available options displayed as radio buttons, and then a value from the drop-down list, depending on the action: - If you select Rewrite to > Static, enter the string that will replace the original URL path (or query string). For example, enter welcome-gb.html to rewrite the original URL path to /welcome-gb.html. - If you select Rewrite to > Dynamic, enter a rewrite expression that defines the dynamic URL rewrite to perform. - If you do not want to change the value of a component of the original request (the URL path or the URL query string), choose Preserve for that component.

For more information, refer to URL rewrite parameters. 7. (Optional) Under Place at, define where to place the rule in the rules list: first rule in the list, last rule in the list, or in a custom position (after a given rule). 8. To save and deploy your rule, select Deploy. If you are not ready to deploy your rule, select Save as Draft.

If you are matching a hostname in your rule expression, you may be prompted to create a proxied DNS record for that hostname. Refer to Troubleshooting for more information.

Wildcard pattern parameters

The Cloudflare dashboard offers a simplified user interface for creating URL rewrites based on wildcard matching and replacement. When you select Wildcard pattern, you will have the following parameters available:

  • Request URL: Enter the wildcard pattern using the asterisk ( *) character to match multiple requests. For example, http*://*.example.com/*.
  • Then rewrite the path and/or query: Define the URL rewrite settings including:
  • Path > Target path: Enter the URI path to match, which can include wildcards (for example, /oldpath/*).
  • Path > Rewrite to: Enter the new URI path. You can use wildcard replacement such as ${1} and ${2} to define a dynamic target path (for example, /newpath/${1}). Leave this field empty to remove the URI path.
  • Query > Target query: Enter the query string to match, which can include wildcards (for example, ?sort=*).
  • Query > Rewrite to: Enter the new query string. You can use wildcard replacement such as ${1} and ${2} to define a dynamic query string (for example, ?order=${1}). Leave this field empty to remove the query string.

Refer to URL rewrite parameters for the equivalent rule configuration when using the API.

Notes

The Request URL value is only used to match the incoming request with a rule. It will not be used for capturing URL patterns for rewrites. If you are matching the URL path or query string in Target path or Target query, respectively, make sure that the Request URL pattern also matches the incoming request, or else the rule will not trigger.

To validate URL rewrite rule matches, use Cloudflare Trace. To validate rewritten URLs, check your origin server.

Was this helpful?

YesNo

On this page

Create a URL rewrite rule in the dashboa - 图2Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/rules/transform/url-rewrite/create-dashboard/#page","headline":"Create a URL rewrite rule in the dashboard","description":"Create URL rewrite rules in the Cloudflare dashboard.","url":"https://developers.cloudflare.com/rules/transform/url-rewrite/create-dashboard/","inLanguage":"en","image":"https://developers.cloudflare.com/rules/transform/url-rewrite/create-dashboard/og.png?v=6e8470437d4a0a76","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: Available fields and functions for URL rewrite rules. title: Available fields and functions image: https://developers.cloudflare.com/rules/transform/url-rewrite/reference/fields-functions/og.png?v=7fefbbb932af71a1


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.