Quick Answer
How do you redirect www and non-www domains in Cloudflare?
Decide which version will be primary, confirm DNS records exist for both the root domain and www hostname, then create a 301 permanent redirect in Cloudflare that sends the non-primary version to the primary version.
Controlling Which Version of Your Domain Visitors Use
A domain can be accessed through a
www version such as
www.yourdomain.com or a
non-www version such as
yourdomain.com.
Cloudflare redirect rules can be used to send one version to the other so visitors consistently reach the primary domain you selected.
Before creating the redirect, both hostnames should exist in DNS. After the redirect is configured, the BizStackPro funnel or website should be attached to the primary domain.
Redirect in One Direction Only
Choose either www or non-www as the primary version and redirect the other version to it. Redirecting both directions can create a redirect loop.
Cloudflare Redirect at a Glance
Before You Begin
Decide which domain version should be the primary address before creating any redirect rule.
- Choose either www or non-www as the primary version.
- Confirm DNS entries exist for both the root domain and www.
- Plan to attach the BizStackPro funnel or website to the primary domain after the redirect is configured.
Step 1: Confirm DNS Records in Cloudflare
Open the Domain in Cloudflare
Log in to Cloudflare and select the domain you want to configure.
Open DNS
Open the DNS section.
Confirm the Root Record
Confirm a DNS record exists for the root domain
(@).
Confirm the www Record
Confirm a DNS record also exists for www.
Confirm Both Hostnames Resolve
Make sure both domain versions resolve correctly before creating the redirect rule.
Allow Time After DNS Changes
If you recently changed DNS records, allow propagation time and test again in an incognito window. DNS changes can take up to 24 hours to fully propagate.
Step 2: Create a 301 Redirect Rule
Cloudflare may provide Redirect Rules or the older Page Rules option. Use the method available in your dashboard.
Option A: Redirect Rules
Go to Rules → Redirect Rules, or the available Rules area in Cloudflare, and create a redirect rule.
Option B: Page Rules
Go to Rules → Page Rules and create a Page Rule using a forwarding URL.
Match the Non-Primary Hostname
Set the rule to match the version you want to redirect, such
as www.yourdomain.com when the non-www version is
primary.
Set the Destination
Set the destination to the primary domain while preserving the path where the rule uses a wildcard.
Example destination:
https://yourdomain.com/$1.
Choose 301 Permanent
Use 301 Permanent when standardizing the primary domain.
Save the Rule
Save or deploy the redirect rule.
Page Rules Example
A Page Rule may use a pattern such as
https://www.yourdomain.com/* and forward it to
https://yourdomain.com/$1, or the reverse when
www is your selected primary domain.
301 vs. 302
A 301 redirect is permanent and is the appropriate choice when standardizing a primary domain. A 302 redirect is temporary and should be used only for short-term changes.
Step 3: Test and Troubleshoot
Allow the Rule to Apply
Redirect rules typically apply within minutes.
Open an Incognito Window
Test the redirect in an incognito or private browser window.
Test Both Domain Versions
Try both the root and www versions and confirm the non-primary version redirects to the primary version.
Frequently Asked Questions
What should I do if my domain redirect is not working as expected?
Confirm DNS records exist for both root and www. Verify the redirect rule is targeting the correct hostname with a wildcard path. Test in an incognito window, then clear cache if needed. Also check for conflicting rules or redirect loops.
How long does it take for the domain redirect to become active?
Redirect rules typically apply within minutes, but DNS changes can take up to 24 hours to fully propagate. If you recently changed DNS, allow time and retest in incognito.
Can I set up multiple redirects using Cloudflare rules?
Yes. You can create multiple redirect rules as long as they don’t conflict. Keep your rules organized and avoid overlapping patterns that could create loops.
What is the difference between a 301 and 302 redirect, and which one should I use?
A 301 redirect is permanent and is best for SEO when you’re standardizing a primary domain. A 302 redirect is temporary and should be used only for short-term changes.
Continue Learning
Continue with related domain guides for connecting your primary domain to BizStackPro or using BizStackPro’s own URL Redirects setup.


