Ultra Web Hosting Docs

Page Rules & Redirects

Cloudflare Page Rules let you apply specific settings to URLs that match a pattern. They are commonly used for redirects, HTTPS enforcement, and cache control. The free Cloudflare plan includes 3 page rules per domain.

What Are Page Rules?

Page Rules trigger specific Cloudflare behaviors when a request matches a URL pattern you define. The pattern uses simple wildcard matching where * matches any sequence of characters. For example:

When a request matches a pattern, Cloudflare applies the settings you configured for that rule. If multiple rules match, only the rule with the highest priority (lowest order number) applies.

Note The free Cloudflare plan includes 3 page rules per domain. You can purchase additional page rules in packs of 5 if needed. Use them strategically for the settings that matter most.

Common Page Rules

Always Use HTTPS

This rule redirects all HTTP requests to HTTPS. It is one of the most commonly used page rules.

  1. In your Cloudflare dashboard, go to RulesPage Rules.
  2. Click Create Page Rule.
  3. Enter the URL pattern: http://yourdomain.com/*
  4. Select the setting: Always Use HTTPS.
  5. Click Save and Deploy.

Repeat with http://www.yourdomain.com/* if you also use the www version. Alternatively, you can enable Always Use HTTPS globally under SSL/TLSEdge Certificates without using a page rule.

Forwarding URL (Redirects)

The Forwarding URL setting lets you redirect visitors from one URL to another. You can choose between a 301 (Permanent) or 302 (Temporary) redirect.

Cache Level Bypass

This rule tells Cloudflare to skip caching entirely for matched URLs. This is useful for admin areas and other dynamic pages where you always want fresh content from the server.

Example: Redirect www to non-www

To redirect all traffic from www.yourdomain.com to yourdomain.com:

  1. Go to RulesPage Rules and click Create Page Rule.
  2. Enter the URL pattern: www.yourdomain.com/*
  3. Select Forwarding URL with a 301 - Permanent Redirect.
  4. Set the destination URL to: https://yourdomain.com/$1
  5. Click Save and Deploy.

The $1 captures whatever matched the * wildcard and appends it to the destination URL. So www.yourdomain.com/about redirects to yourdomain.com/about.

To do the reverse (non-www to www), swap the pattern and destination:

Example: Redirect Old Domain to New Domain

If you have moved your website from old-domain.com to new-domain.com, you can use Cloudflare to redirect all traffic. Both domains must be added to your Cloudflare account.

  1. Add old-domain.com to Cloudflare and point its nameservers to Cloudflare.
  2. Go to RulesPage Rules for old-domain.com.
  3. Create a page rule with the pattern: old-domain.com/*
  4. Select Forwarding URL with a 301 - Permanent Redirect.
  5. Set the destination URL to: https://new-domain.com/$1
  6. Click Save and Deploy.

This preserves the URL path, so old-domain.com/contact redirects to new-domain.com/contact.

Example: Bypass Cache for WordPress Admin

To ensure the WordPress admin area is never cached (preventing potential issues with stale admin pages):

  1. Create a page rule with the pattern: yourdomain.com/wp-admin/*
  2. Set Cache Level to Bypass.
  3. Optionally, also disable Rocket Loader and Auto Minify for the admin area to avoid script conflicts.
  4. Click Save and Deploy.
Tip If you only have 3 page rules and need to bypass cache for both /wp-admin/* and /wp-login.php, you can use the pattern yourdomain.com/wp-* to cover both with a single rule.

Bulk Redirects

Cloudflare's Bulk Redirects feature is a newer alternative to page rules for handling redirects. It allows you to create lists of URL redirects without using page rules, which is useful when you need more than 3 redirects on the free plan.

  1. In your Cloudflare dashboard, go to RulesBulk Redirects.
  2. Click Create Bulk Redirect List.
  3. Add your source and destination URLs to the list.
  4. Create a Bulk Redirect Rule that references your list.
  5. Deploy the rule.

Bulk Redirects are ideal when you are migrating a site and need to redirect dozens or hundreds of individual URLs. They do not count against your page rule limit.

Note Bulk Redirects handle exact URL matches and simple path-based redirects. For wildcard pattern matching (like redirecting an entire subdomain), Page Rules are still the better option.

Page Rules vs .htaccess Redirects

Both Cloudflare Page Rules and .htaccess rules can handle redirects, but they work at different levels:

When to use Cloudflare redirects:

When to use .htaccess redirects:

Tip Cloudflare redirects happen at the edge, which means they execute before the request reaches your server. This makes them faster and reduces load on your hosting account. For high-traffic sites, moving simple redirects to Cloudflare Page Rules can noticeably reduce server resource usage.