Cloudflare - Redirect WWW to Non WWW (Naked Domain)

Tutorial for setting up a Cloudflare Page Rule to Redirect all WWW traffic to your Non WWW Naked Domain on Cloudflare.

Last updated on 11/21/2021


This tutorial will show you how to redirect all of your WWW domain traffic to your non-WWW (naked) domain using a Cloudflare Page Rule.

Example: https://www.example.com 301 redirect --> https://example.com

Once you've navigate to the Rules Tab, click Create Page Rule. Cloudflare Rules Page

Set the URL Match Value to your WWW Domain

For www.example.com we would set the URL Match value to https://www.example.com/*: Cloudflare Url Match Textbox

Add a Forwarding URL Rule to the Settings

  • From the Pick a Setting dropdown, select Forwarding URL

  • Then set the Select status code dropdown to 301 - Permanent Redirect

  • Next set the Ender destination URL to https://example.com/$1 Cloudflare Rules 301 Redirect Settings

Click 'Save and Deploy' and Test the New Page Rule

Click Save and Deploy and your rule should be in place.

Now let's test that your WWW subdomain www.example.com redirects to your non-WWW domain (naked domain) at example.com.

  • Open up your favorite web browser and open the developer tools (I'm using Chrome).

  • Type your WWW domain, www.example.com into your navigation bar.

  • You should see the 301 redirect in the Network tab of your developer tools:

Cloudflare Rules 301 Redirect Works Properly

Additional Resources

Understanding and Configuring Cloudflare Page Rules (Page Rules Tutorial)