---
description: Example Transform Rules for URL rewrites and header modifications.
title: Transform Rules examples
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-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.

# Transform Rules examples

Last updated Sep 1, 2026|Copy as Markdown| [View as Markdown](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/index.md)| [Agent setup](https://0285ca83.previews.developers.cloudflare.com/agent-setup/)

[**Add a wildcard CORS response header** Create a CORS response header transform rule to add an `Access-Control-Allow-Origin` HTTP header to the response with wildcard as static value. (`cookiename=value`).](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/add-cors-header/)

[**Add a request header with the current bot score** Create a request header transform rule to add a `X-Bot-Score` HTTP header to the request with the current bot score.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/add-request-header-bot-score/)

[**Add request header with a static value** Create a request header transform rule to add an `X-Source` HTTP header to the request with a static value (`Cloudflare`).](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/add-request-header-static-value/)

[**Add a request header for subrequests from other zones** Create a request header transform rule to add an HTTP header when the Workers subrequest comes from a different zone.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/add-request-header-subrequest-other-zone/)

[**Add a response header with a static value** Create a response header transform rule to add a `set-cookie` HTTP header to the response with a static value (`cookiename=value`).](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/add-response-header-static-value/)

[**Normalize encoded slashes in URL path** Create a URL rewrite rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`).](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/normalize-encoded-slash/)

[**Remove a request header** Create a request header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the request.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/remove-request-header/)

[**Remove a response header** Create a response header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the response.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/remove-response-header/)

[**Rewrite blog archive URLs** Create a transform rule to rewrite the URL format `/posts/<YYYY>-<MM>-<DD>-<TITLE>` to the new format `/posts/<YYYY>/<MM>/<DD>/<TITLE>`.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-archive-urls-new-format/)

[**Rewrite path of moved section of a website** Create a URL rewrite rule (part of Transform Rules) to rewrite everything under `/blog/<PATH>` to `/marketing/<PATH>`.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-moved-section/)

[**Rewrite path of archived blog posts** Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/news/2012/...` URI paths to `/archive/news/2012/...`.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-path-archived-posts/)

[**Rewrite path for object storage bucket** Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/files/...` URI paths to `/...`.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-path-object-storage/)

[**Rewrite image paths with several URL segments** Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/images/<FOLDER1>/<FOLDER2>/<FILENAME>` to `/img/<FILENAME>`.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-several-url-different-url/)

[**Rewrite URL query string** Create a transform rule to rewrite the request path from `/blog` to `/blog?sort-by=date`.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-url-string-visitors/)

[**Rewrite page path for visitors in specific countries** Create two URL rewrite rules (part of Transform Rules) to rewrite the path of the welcome page for visitors in specific countries.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/rewrite-welcome-for-countries/)

[**Set a response header with the current bot score** Create a response header transform rule (part of Transform Rules) to set an `X-Bot-Score` HTTP header in the response with the current bot score.](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/set-response-header-bot-score/)

[**Set response header with a static value** Create a response header transform rule (part of Transform Rules) to set an `X-Bot-Score` HTTP header in the response to a static value (`Cloudflare`).](https://0285ca83.previews.developers.cloudflare.com/rules/transform/examples/set-response-header-static-value/)

Was this helpful?

YesNo

## On this page

[![](https://0285ca83.previews.developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://0285ca83.previews.developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/rules/transform/examples/#page","headline":"Transform Rules examples · Cloudflare Rules docs","description":"Example Transform Rules for URL rewrites and header modifications.","url":"https://developers.cloudflare.com/rules/transform/examples/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-09-01","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/"}}
```
