Create a URL Rewrite Rule in the dashboard
Create URL Rewrite Rules in the Transform Rules tab under Rules. Refer to URL rewrite examples for examples of rule definitions.
Log in to the Cloudflare dashboard, and select your account and website.
Go to Rules > Transform Rules.
Click Create transform rule > Rewrite URL.
In the page that displays, enter a descriptive name for the rule in Rule name.
Under If incoming requests match, use the Field drop-down list to choose an HTTP property. For each request, the value of the property you choose for Field is compared to the value you specify for Value using the operator selected in Operator.
The Expression Preview area displays a text-only version of your expression. For more information on entering a rule expression manually using the Expression Editor, refer to Edit rule expressions in the Firewall documentation.
Select a comparison operator in the Operator drop-down list.
Specify the value to match. If the value is an enumeration, the Value control will be a drop-down list. Otherwise, it will be a text input.
(Optional) To create a compound expression using logical operators, click And or Or.
To define the action for your URL Rewrite Rule, select 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 the Preserve action for that component.
To save and deploy your rule, click Deploy. If you are not ready to deploy your rule, click Save as Draft.
After you choose an option, you return to the Transform Rules dashboard interface, which displays your new rule.
If you choose to deploy your URL Rewrite Rule, the new rule will be enabled. If you save the rule as a draft, the new rule will be disabled.