- The site runs on www.client.com, served by Cloudflare Pages.
- In cPanel, the
wwwrecord becomes a CNAME to the Pages project. - The bare domain
client.comstays on cPanel and 301-redirects to www. - Email (MX), and every other DNS record, stays exactly as it is.
Why it works this way
Cloudflare Pages can serve a subdomain (like www) when the DNS lives somewhere else: you just point a CNAME at it. The bare domain (client.com) can only point at Pages if the whole DNS zone is on Cloudflare. We don't want that, so the bare domain stays on cPanel and redirects to www. Visitors and Google see one clean site at https://www.client.com.
Which sites to put on Cloudflare
| Site type | Host it on |
|---|---|
| Static sites — plain HTML/CSS/JS, Astro, Next.js static export, AI-built landing pages | Cloudflare Pages |
| WordPress, anything with PHP, a MySQL database, or server-side forms | cPanel (Pages can't run PHP) |
Contact forms on a static site need a form service (or a Cloudflare Pages Function). Plan that before you move a site that has a form.
Before you start — checklist
- You can log in to the client domain's cPanel → Zone Editor.
- You have access to the DNR Cloudflare account (ask Shaw if not).
- The site's files are ready (a folder with
index.html, or a Git repo). - In Zone Editor, note what the current
wwwrecord is. Take a screenshot — that is your rollback. - Check for CAA records. If any exist, they must allow Cloudflare's certificate authorities (add
letsencrypt.org,pki.googandssl.com), or the SSL certificate will not issue. No CAA records at all = fine.
Step-by-step
Part A — Put the site on Cloudflare Pages
- Log in to the Cloudflare dashboard. Go to Workers & Pages → Create → Pages.
- Choose Upload assets (drag in the site folder) or Connect to Git (the site redeploys on every push).
- Name the project after the client, e.g.
acme-plumbing. Deploy. - Open the
acme-plumbing.pages.devlink and check the site works.
Part B — Connect www.client.com
- In the Pages project, open Custom domains → Set up a custom domain.
- Enter
www.client.comand continue. Cloudflare shows a CNAME target — it is the project's.pages.devaddress.
Do this step first Add the domain in Pages before you change DNS, or the domain will not verify. - In the client's cPanel → Zone Editor, find the existing
wwwrecord (often a CNAME toclient.com, or an A record). Edit it, don't add a second one:Name: www.client.com. Type: CNAME Record: acme-plumbing.pages.dev TTL: 300 - Back in Cloudflare, wait until the custom domain shows Active. Usually a few minutes; can take up to 24 h. Cloudflare issues the SSL certificate on its own.
- Open
https://www.client.com— it should load the new site with a padlock.
Part C — Redirect the bare domain to www
The bare domain keeps its A record pointing at the cPanel server. Add a permanent redirect there.
- In cPanel, open File Manager, go to the domain's document root (usually
public_html) and edit.htaccess(turn on "Show hidden files"). Add at the top:
ReplaceRewriteEngine On RewriteCond %{HTTP_HOST} ^client\.com$ [NC] RewriteRule ^(.*)$ https://www.client.com/$1 [R=301,L]client\.comandwww.client.comwith the real domain (keep the\.in the first one). - Make sure the bare domain has a valid SSL certificate on cPanel (SSL/TLS Status → Run AutoSSL). Without it,
https://client.comshows a warning before the redirect. - Test all four — each must end on
https://www.client.com:http://client.com https://client.com http://www.client.com https://www.client.com
No-code alternative: cPanel → Domains → Redirects, type Permanent (301), domain client.com, redirect to https://www.client.com/, and choose Do not redirect www.
Troubleshooting
| Symptom | Fix |
|---|---|
| Custom domain stuck on "Pending" / "Verifying" | Check the www CNAME is exactly the .pages.dev address and that there is no second www record (A or AAAA). Check CAA records. Then wait — DNS can take time. |
| Redirect loop | The .htaccess rule must match only the bare domain (^client\.com$), never www. |
Padlock warning on https://client.com | Run AutoSSL in cPanel for the bare domain. |
AutoSSL reports an error for www | Expected: www no longer points at cPanel, and Cloudflare covers it. You can exclude www in SSL/TLS Status to silence it. |
| Images or CSS missing on the live site | Look for links hard-coded to http:// or the old server path. Use relative paths. |
Rollback
Set the www record in Zone Editor back to what it was (your screenshot) and remove the redirect from .htaccess. The old cPanel site is live again once DNS updates.
Doing this for many clients
Past roughly 20 sites, ask Shaw about Cloudflare for SaaS: each client still adds one www CNAME, but it points at a DNR-owned hostname, and all certificates are managed in one place.