Table of Contents
- Why Mastering Cloudflare Redirects Is a Game Changer
- Cloudflare Redirect Methods at a Glance
- The Scale of Modern Redirects
- Handling Everyday Redirects with Redirect Rules
- Static vs. Dynamic Redirects
- Choosing Your Redirect Status Code
- Using Legacy Page Rules for Specific Scenarios
- How to Set Up a Root Domain Redirect
- When to Migrate to Redirect Rules
- Executing Advanced Redirects with Cloudflare Workers
- When to Choose Workers for Your Redirects
- A Practical Worker Script Example
- How to Test and Troubleshoot Your Redirects
- Verifying Redirects with Developer Tools
- Fixing Common Redirect Problems
- Still Have Questions About Cloudflare Redirects?
- What's the Real Difference Between a 301 and 302 Redirect?
- How Many Redirects Do I Get on the Free Plan?
- Can I Redirect My Root Domain to a Notion Site on a Subdomain?
Slug
cloudflare-url-redirect
Excerpt
Master the Cloudflare URL redirect. This guide covers Redirect Rules, Page Rules, and Workers with practical examples for your Notion website.
Redirects are more than just a technical fix; they're essential for guiding visitors after a site redesign, creating clean marketing links, and protecting your hard-earned SEO. If you're running a Notion site with a custom domain, mastering the Cloudflare URL redirect is a non-negotiable skill for managing your traffic and keeping everything running smoothly.
Why Mastering Cloudflare Redirects Is a Game Changer
URL redirects might seem like a small detail, but they form the backbone of a healthy, user-friendly website. Think about it: whenever a URL for your content changes—maybe you've restructured your blog or updated a page title—a redirect acts as a digital signpost. It seamlessly guides visitors and search engine crawlers from the old address to the new one.
Without proper redirects, you're creating dead ends. Visitors land on a frustrating "404 Not Found" page, and the SEO authority you built up for that old link simply vanishes into thin air. For anyone using Notion with a custom domain, especially through a service like Sotion, this is a critical piece of the puzzle. You need to make sure every visitor, whether they're coming from an old social media post or a bookmark, finds exactly what they're looking for.
But this process is about much more than just avoiding broken links. It's a strategic tool for:
- Protecting SEO Value: A 301 (permanent) redirect is your way of telling search engines to transfer all the ranking power from an old URL to its new replacement.
- Improving User Experience: Nobody likes hitting a wall. Smooth redirection keeps your audience engaged and prevents them from bouncing off your site in frustration.
- Simplifying Marketing Efforts: You can create short, memorable URLs for your campaigns that point to longer, more complex Notion page URLs. It's a simple trick that makes a big difference.
This chart breaks down the decision-making process, helping you pick the right Cloudflare redirect method for the job.

As you can see, straightforward needs can be handled with simple rules. When things get more complex, however, you'll need to reach for more advanced tools like Cloudflare Workers.
Cloudflare Redirect Methods at a Glance
Choosing the right tool can feel overwhelming at first. This table gives you a quick rundown of the main redirect options inside Cloudflare, so you can pick the best one for your situation.
Method | Best For | Complexity | Common Use Case |
Redirect Rules | Simple, static redirects for entire domains or specific paths. | Low | Redirecting an old domain to a new one (e.g., old-brand.com to new-brand.com). |
Page Rules | Older method for URL forwarding and other settings (3 rules on the free plan). | Low | Forwarding a specific URL like domain.com/promo to a new page. |
Cloudflare Workers | Complex, conditional redirects based on logic like country, device, or cookies. | High | A/B testing, geo-targeting redirects, or custom authentication logic. |
Each method has its place. For most day-to-day tasks, Redirect Rules are your best friend. But when you need surgical precision or dynamic logic, Workers give you all the power you could ask for.
The Scale of Modern Redirects
The infrastructure making all of this possible operates on an incredible scale. The global network behind these redirects is massive. For instance, Cloudflare’s 1.1.1.1 resolver handles an average of 1.9 trillion DNS queries every single day. With data centers all over the world, over 80% of queries are served directly from a nearby cache, which is why your redirects feel instantaneous. You can read more about this on the official Cloudflare blog.
Whether you're a solo creator building a personal brand or an agency managing client websites, knowing how to implement these redirects is a powerful skill. It gives you the control you need to build a resilient and professional web presence.
Handling Everyday Redirects with Redirect Rules
For most of the forwarding you'll ever need to do, Cloudflare's Redirect Rules are the best tool for the job. They give you a straightforward way to set up a URL redirect without needing to dive into more complex settings. Think of this as your first stop for the vast majority of redirect tasks.
So, when would you use them? Imagine you've rebranded and need to push all traffic from your old domain to the new one. Or maybe you just updated a super popular blog post and want the old link to point to the fresh content. Redirect Rules are perfect for these kinds of jobs. You'll find them under the "Rules" section in your Cloudflare dashboard, with a clean interface for setting up your forwarding logic.
This is also the right place to handle canonical domains. You can easily set up a rule to forward all
http:// traffic to https://, or to make sure visitors who type yourdomain.com end up on www.yourdomain.com. Getting this right is a small but important step for consolidating your SEO power.Static vs. Dynamic Redirects
When you go to create a new rule, you'll be met with two main choices: static and dynamic.
- Static Redirect: This is as simple as it gets. You define one source URL and one destination URL. It’s a direct, one-to-one mapping that's ideal for redirecting a single page or an entire domain to a specific new location.
- Dynamic Redirect: This option gives you a lot more flexibility. It lets you use expressions to construct the final destination URL based on what the incoming request looks like. This is incredibly handy for keeping the URL path intact after a domain change.
The Cloudflare dashboard lays this all out for you pretty clearly.

As you can see, the interface keeps the incoming request criteria separate from the forwarding action, which makes it easy to understand exactly what the rule will do before you hit save.
Choosing Your Redirect Status Code
One of the most important choices you'll make here is the status code: 301 (Permanent) or 302 (Temporary). This decision really matters for SEO.
A 301 Permanent Redirect tells search engines that the content has moved for good. Google and others will then transfer almost all of the ranking power (often called "link equity") from the old URL to the new one. This is what you should use 99% of the time—for things like updating a URL slug or moving to a new domain.
On the other hand, a 302 Temporary Redirect signals that the move is just temporary and the original URL will be back. Search engines won't pass along any link equity because they expect the old page to return. This is only useful for short-term scenarios, like A/B testing a new landing page or redirecting users while you're doing site maintenance. Using a 302 for a permanent change is a common mistake that can seriously hurt your SEO.
For those of us using Notion for our websites, managing a custom domain is a key part of building a professional presence. Making sure your traffic is properly redirected is a foundational piece of that puzzle. If you haven't set one up yet, you can learn more from our guide on how to add a Notion site custom domain. Once you get comfortable with Redirect Rules, you can be confident that every visitor and search engine crawler will always find their way to the right page.
Using Legacy Page Rules for Specific Scenarios
Before Redirect Rules were the go-to solution, Page Rules were the original way to handle a Cloudflare URL redirect. While Cloudflare now steers everyone toward the newer system, you’ll definitely still run into Page Rules, especially if you’re working with a domain that’s been around for a while. It pays to know how they work.
Think of Page Rules as a Swiss Army knife. Redirect Rules are purpose-built for one job, but a single Page Rule can juggle multiple tasks—it can forward a URL, but it can also tweak cache levels or apply specific security settings. That flexibility is great, but it comes at a cost: on the free plan, you only get three Page Rules. That scarcity means you have to be smart about how you use them.
For a lot of Sotion users, the most common reason to use a Page Rule is to push traffic from the root domain (like
yourdomain.com) over to the www subdomain where their Notion site is actually hosted.How to Set Up a Root Domain Redirect
Let’s get this crucial redirect configured. The idea is to make sure that when someone types
yourdomain.com into their browser, they get automatically sent to www.yourdomain.com without losing the rest of the URL.Here’s the breakdown:
- Head into your Cloudflare dashboard, pick your domain, and find Rules > Page Rules.
- Click Create Page Rule.
- In the “If the URL matches” box, type your root domain followed by a wildcard. It’ll look like this:
yourdomain.com/*
- For the settings, choose Forwarding URL from the dropdown menu.
- Set the status code to 301 - Permanent Redirect.
- Finally, in the destination URL field, enter the
wwwversion with a special variable:https://www.yourdomain.com/$1
That
/* in the first field and the $1 in the destination are the magic ingredients here. This setup tells Cloudflare to grab whatever comes after the domain name and append it to the new URL. So, a visit to yourdomain.com/about will correctly land on https://www.yourdomain.com/about, instead of just dumping the visitor on your homepage.When to Migrate to Redirect Rules
So, when should you ditch Page Rules? If your needs are purely about redirects and you find yourself needing more than the three rules you get for free, it's time to make the switch. Moving over to Redirect Rules is the clear path forward.
Cloudflare’s broader redirect tools are built to handle just about anything. You have options ranging from simple Single Redirects for one-off changes to Bulk Redirects designed for massive, enterprise-scale migrations. For a deeper dive, DZone has a great article on mastering Cloudflare redirects. For any new project, just do yourself a favor and start with the modern and more powerful Redirect Rules from the get-go.
Executing Advanced Redirects with Cloudflare Workers
When your redirect needs get more complex than simple URL forwarding, it's time to bring in the heavy hitter: Cloudflare Workers. While standard Redirect Rules are fantastic for straightforward, one-to-one mapping, they hit a wall when you need to introduce any kind of conditional logic. This is where you swap the simple dashboard UI for the raw power of custom JavaScript, running right at the edge before a request ever touches your server.
This approach completely changes the game. Workers let you build a Cloudflare URL redirect based on dynamic conditions, giving you programmatic control over how your traffic is routed. Think of it as a serverless function that intercepts incoming requests, allowing you to decide on the fly where they should go.

This method is perfect for situations where a simple rule just won’t do the job. For instance, if you want to run an A/B test, a Worker can easily split traffic by redirecting a percentage of your users to a new landing page. You could also redirect users based on their geographic location, device type, or even whether a specific cookie is present.
When to Choose Workers for Your Redirects
Workers are incredibly powerful, but that doesn't mean they're the right tool for every job. You should reach for them when your requirements involve conditional logic that you just can't express in a standard Redirect Rule.
A Worker is probably your best bet if you need to:
- A/B Test Content: Send 50% of your visitors to one page and the other half to a new variant to see which one performs better.
- Perform Geo-Targeting: Automatically redirect users from a specific country to a localized version of your site.
- Redirect Based on Device: Serve a different, optimized page layout for mobile users compared to those on a desktop.
- Handle Complex URL Rewrites: Implement sophisticated URL restructuring that might involve multiple conditions or even data lookups.
To really get why this is so effective, it helps to understand the broader benefits of serverless architecture that platforms like Cloudflare are built on. This model is exactly what makes the instant, global execution of your custom redirect logic possible.
A Practical Worker Script Example
Getting started with Workers is more straightforward than you might think. The basic idea is to write a script that listens for fetch events, takes a look at the incoming request, and then returns a new
Response object that triggers the redirect.Here’s a simple script that redirects traffic from an old blog path to a new one:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
const oldPath = '/blog/old-post-slug'
const newPath = '/articles/new-post-slug'
// Check if the request path matches the old URL
if (url.pathname === oldPath) {
const newUrl = new URL(newPath, url.origin)
// Return a 301 Permanent Redirect
return Response.redirect(newUrl.toString(), 301)
}
// If no match, fetch the original request
return fetch(request)
}
This snippet shows the core concept in action. You can easily build on this logic to include any number of conditions. For Notion users looking to add more dynamic functionality to their sites, getting comfortable with JavaScript is a huge advantage. To see more of what's possible, check out our guide on using custom JavaScript for Notion pages.
How to Test and Troubleshoot Your Redirects
Setting up a Cloudflare URL redirect is only half the job. You have to make sure it actually works the way you expect it to. A tiny mistake in your setup can seriously mess with your user experience, sending visitors to the wrong page or trapping them in a dreaded redirect loop. Trust me, testing isn't just a suggestion—it's critical for your site's credibility and SEO.
The quickest check is simple: clear your browser cache and try visiting the old URL. If you end up at the new destination, great! But for a real diagnosis, you need to look a little deeper.
Verifying Redirects with Developer Tools
Your browser's built-in developer tools are indispensable for this kind of work. They let you see exactly what's happening behind the scenes and confirm the redirect status code, which is what search engines pay attention to.
Here’s my go-to process:
- First, open a new incognito or private browsing window. This is a crucial step because it ensures you're starting fresh, without any old redirects cached by your browser.
- Next, pull up the developer tools. The shortcut is usually F12 or Cmd+Option+I on a Mac. Head over to the Network tab.
- Look for a checkbox that says "Disable cache" and make sure it's ticked. This forces your browser to fetch a new response directly from the server every time.
- Finally, type your old URL into the address bar and hit Enter.
You’ll see a waterfall of network requests fill the panel. The very first one should be your original URL, and its status code should be either 301 or 302. That's your confirmation that the redirect is firing. Right after that, you should see a request for the new URL with a 200 status code, which means the destination page loaded just fine.

Fixing Common Redirect Problems
Even when you're careful, things can go wrong. The most common headache I see is a redirect loop, where Page A points to Page B, but Page B mistakenly points right back to Page A.
To untangle this mess, take a close look at the execution order of your rules in the Cloudflare dashboard. Rules higher up in the list run first, so you need to make sure they’re sequenced logically. Also, check your rule conditions. A classic error is using a broad match like "contains" when a precise "equals" is needed, causing the rule to fire on URLs you never intended it to.
Sometimes, the issue isn't a bad rule but just a delay. Changes can take time to ripple through the internet's infrastructure, a process known as DNS propagation. Understanding this can save you a lot of troubleshooting headaches, as it explains why a fix might not seem to work instantly. And if you're navigating a full domain migration for your Notion site, our guide on how to change a domain provides some extra context that pairs nicely with these steps.
Still Have Questions About Cloudflare Redirects?
As you start wrangling your site's traffic, a few common questions always seem to pop up. Getting straight answers is the key to building a redirect strategy that works, especially when you're connecting a custom domain to a Notion-based website. Let's clear up some of the most frequent queries we hear from users.
What's the Real Difference Between a 301 and 302 Redirect?
Picking the right status code isn't just a technical detail—it's a critical decision for your SEO.
A 301 redirect is your way of telling search engines like Google that a page has moved permanently. This is a big deal. It signals them to transfer all the SEO juice, or "link equity," from the old URL to the new one. You’ll want to use a 301 for permanent changes, like when you've updated a blog post's URL or completely rebranded your domain.
On the flip side, a 302 redirect is temporary. It tells search engines, "Hey, this page is just gone for a little while, but it'll be back, so don't update your index." This is perfect for short-term things, like running an A/B test on a new landing page or during a quick site maintenance window. Using a 302 for a permanent move is a classic mistake that can seriously hurt your new page's ability to rank.
How Many Redirects Do I Get on the Free Plan?
This depends entirely on which tool you're using inside Cloudflare. The good news is that their free plan is surprisingly generous and usually more than enough for most creators and small businesses.
- Redirect Rules: This is the modern, recommended way to do it. The free plan gives you 10 dynamic rules.
- Page Rules: The older system is a bit more constrained, offering just 3 rules.
- Bulk Redirects: If you're dealing with a massive list of URLs, you can manage up to 10,000 URLs spread across 5 different lists.
For almost everyone running a Notion site, those 10 Redirect Rules will be more than enough to handle all your forwarding needs without ever hitting a paywall.
Can I Redirect My Root Domain to a Notion Site on a Subdomain?
Absolutely. In fact, this is a standard setup that we highly recommend. Many Notion websites live on a
www subdomain (like www.yourdomain.com). To create a smooth experience for your visitors, you need to make sure that anyone who types in your root domain (yourdomain.com) gets sent to the right place.You can set this up with either a Redirect Rule or a Page Rule. The goal is to create a permanent 301 redirect that keeps the URL path intact. That way, a request for
yourdomain.com/contact correctly lands on www.yourdomain.com/contact. We actually walk through this exact scenario in our section on Page Rules.Ready to turn your Notion pages into a professional website with seamless domain management? With Sotion, you can launch a fully branded site in minutes, complete with custom domains, member access, and more—no code required. Get started with Sotion today!
_circle.png)
