Header Menu

← All Blogs

How to redirect root domain to www in Cloudflare

andthezhang

7/23/2024

#Next.js#Vercel#Cloudflare
How to redirect root domain to www in Cloudflare

A common practice on domain redirect

In Vercel, when adding a custom domain to a project, by default, the root domain (e.g., example.com) is redirected to the www subdomain (e.g., www.example.com). This is a common practice to ensure that all traffic is directed to a single canonical domain.

How about Cloudflare?

But how to do it in Cloudflare? Here's a step-by-step guide to setting up a similar redirect in Cloudflare:

Built With NextStatic