URL forwarding with Page Rules
Last updated May 5, 2026 Page Rules allow you to forward or redirect traffic to a different URL, though they are just one of the options provided by Cloudflare.
Note
Consider alternative Rules options due to their enhanced configurability. Refer to the migration guide for details.
For more flexibility and customization, consider using Snippets.
Redirect with Page Rules
To configure URL forwarding or redirects using Page Rules:
- In the Cloudflare dashboard, go to the Page Rules page. Go to Page Rules ↗
- Select Create Page Rule.
- Under If the URL matches, enter the URL or URL pattern that should match the rule.
- In Pick a Setting, choose Forwarding URL from the drop-down menu.
- For Select status code, choose 301 - Permanent Redirect or 302 - Temporary Redirect.
- Enter the destination URL.
- Select Save and Deploy Page Rule.
Note
Page Rules require a proxied DNS record to work. Page Rules will not apply to subdomains that do not exist in DNS or are not being directed to Cloudflare.
Forwarding examples
Imagine you want site visitors to reach your website for a variety of URL patterns. For instance, the page rule URL patterns *www.example.com/products and *example.com/products match:
http://example.com/products
http://www.example.com/products
https://www.example.com/products
https://blog.example.com/products
https://www.blog.example.com/products
but do not match:
http://www.example.com/blog/products (extra directory)
or
http://www.example.comproducts (no trailing slash)
Once you have created the pattern that matches what you want, select the Forwarding toggle. This will display a field where you can enter the address you want requests forwarded to.
https://example.com/products
If you enter the address above in the forwarding box and select Add Rule, within a few seconds any requests that match the pattern you entered will automatically be forwarded with an HTTP 302 redirect status code to the new URL.
Advanced forwarding options
If you use a basic redirect, such as forwarding the apex domain (example.com) to www.example.com, then you lose anything else in the URL.
For example, you could set up the pattern:
example.com
And have it forward to:
http://www.example.com
However, if someone entered example.com/some-particular-page.html, they would be redirected to:
www.example.com
Instead of:
www.example.com/some-particular-page.html
The solution is to use variables. Each wildcard corresponds to a variable when can be referenced in the forwarding address. The variables are represented by a $ (dollar sign) followed by a number. To refer to the first wildcard you would use $1, to refer to the second wildcard you would use $2, and so on.
To fix the forwarding from the apex to www in the above example, you could use the same pattern:
example.com/*
You would then set up the following URL for traffic to forward to:
http://www.example.com/$1
In this case, if someone went to:
example.com/some-particular-page.html
They would be redirected to:
http://www.example.com/some-particular-page.html
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/rules/page-rules/how-to/url-forwarding/#page","headline":"URL forwarding with Page Rules","description":"Create URL forwarding rules with Page Rules.","url":"https://developers.cloudflare.com/rules/page-rules/how-to/url-forwarding/","inLanguage":"en","image":"https://developers.cloudflare.com/rules/page-rules/how-to/url-forwarding/og.png?v=a948420ef97ab698","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":["Redirects"]}
description: Create, edit, and manage Page Rules in the dashboard. title: Manage Page Rules image: https://developers.cloudflare.com/rules/page-rules/manage/og.png?v=1dc5f72f1baecb51
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.
Docs