Master the Art of Cloudflare Redirects: Learn Setup of 301 Redirects with Page Rules

Master the Art of Cloudflare Redirects: Learn Setup of 301 Redirects with Page Rules

Table of Contents

  1. Introduction
  2. Adding Your Domain to Cloudflare
  3. Updating Name Servers at the Registrar
  4. Updating Cloudflare's DNS
    • Deleting Unused Records
    • Adding A Record
    • Adding CNAME Record
  5. Setting Up Page Rules
  6. Conclusion

How to 301 Redirect Using Cloudflare's DNS and Page Rules

In this article, we will guide you through the process of setting up a 301 redirect using Cloudflare's DNS and page rules. We will cover each step in detail to ensure that you can easily follow along and implement the redirect successfully.


When it comes to managing website redirects, Cloudflare provides an efficient and user-friendly solution. By utilizing Cloudflare's DNS and page rules, you can easily redirect traffic from one URL to another. In this article, we will walk you through the process step by step, ensuring that you have a clear understanding of each action required.

Adding Your Domain to Cloudflare

Before you can set up a redirect, you need to add your domain to Cloudflare. If you have already done this, you can skip this step. However, if you haven't, you'll need to navigate to the Cloudflare website and click on "Add Site." Enter your domain and click "Add" to proceed.

Updating Name Servers at the Registrar

After adding your domain to Cloudflare, you need to update the name servers at your domain registrar. This step ensures that the traffic is routed through Cloudflare's network. To do this, log in to your domain registrar's website, locate the "Edit Settings" or "Name Servers" section, and input the name servers provided by Cloudflare after adding your site. Save your changes, and you're ready to move on to the next step.

Updating Cloudflare's DNS

Once you have completed the previous steps, it's time to update Cloudflare's DNS. Start by navigating to the DNS section in your Cloudflare account. Here, you will find a list of existing records associated with your domain. If there are any unused or unnecessary records, you can delete them. However, exercise caution when deleting records to avoid unintentional removal of crucial settings.

To add a new record, click on the "Add Record" button. Choose the record type, such as "A" or "CNAME," depending on your requirements. For a "A" record, enter the "@" symbol followed by the IP address provided by Cloudflare. Save the record to apply the changes.

Next, add a CNAME record for the "www" subdomain. Enter "www" in the name field, and paste the "@" or target value provided by Cloudflare. Save the record, and you should now have both an "A" record and a "CNAME" record associated with your domain.

Setting Up Page Rules

With the DNS settings updated, you can proceed to set up page rules for the desired redirects. In the Cloudflare dashboard, navigate to the "Page Rules" section. Here, you can create rules that define how traffic should be redirected.

To set up a 301 redirect for the root domain and all inner URLs, create a page rule that matches the domain with a wildcard. Select "URL Forwarding" as the setting, and choose "301 Redirect" as the type of forwarding. Specify the destination URL where you want the traffic to be redirected. Save the rule and deploy the changes.

Next, create another page rule for the "www" subdomain. Follow the same steps as before, but this time, include the entire domain, including the "www" prefix. This ensures that traffic coming through the "www" subdomain also gets redirected to the desired location. Save and deploy the rule.


By following the steps outlined in this article, you can easily set up a 301 redirect using Cloudflare's DNS and page rules. Remember to wait for DNS propagation to ensure that the changes take effect correctly. With Cloudflare's intuitive interface and powerful features, managing redirects becomes a seamless process, benefiting both website owners and visitors.



  • Learn how to set up a 301 redirect using Cloudflare's DNS and page rules
  • Understand the step-by-step process to ensure successful implementation
  • Easily add your domain to Cloudflare and update the DNS settings
  • Set up page rules to define the desired redirects for both the root domain and subdomains
  • Benefit from Cloudflare's efficient management of website redirects


Q: Can I skip adding my domain to Cloudflare if I have already done it?

A: Yes, if you have already added your domain to Cloudflare, you can skip that particular step and move on to the next ones.

Q: Do I need to wait for DNS propagation before the redirect takes effect?

A: Yes, DNS propagation can take some time, so it's essential to wait for the changes to propagate before expecting the redirect to work correctly.

Q: Can I set up different redirects for specific URLs on my website?

A: Yes, you can utilize multiple page rules to set up redirects for specific URLs or subdirectories on your website. Simply create additional page rules and specify the desired destinations for each.

Q: What if I encounter issues during the setup process?

A: If you face any difficulties or have questions, feel free to ask in the comments section below the article. We are here to help you troubleshoot and ensure a successful setup.


I am an ordinary seo worker. My job is seo writing. After contacting Proseoai, I became a professional seo user. I learned a lot about seo on Proseoai. And mastered the content of seo link building. Now, I am very confident in handling my seo work. Thanks to Proseoai, I would recommend it to everyone I know. — Jean

Browse More Content