Back to Resources
How-To SessionComplexity: LowNo TerminalCloudflare

Redirect Your Domain to www (Cloudflare Redirect Rules)

Example: send yourrescue.org directly to www.yourrescue.org, keeping the path and query string.

This redirect happens before your website loads.

Visitors who type or bookmark your domain without www still land on the right page.

Quick Path

  • Confirm you can log in to Cloudflare and open your domain.
  • Create a CNAME record for @ pointing to www, and make sure it is proxied.
  • Add a Redirect Rule so yourrescue.org redirects to www.yourrescue.org (301, path preserved).
  • Test in a private/incognito window.
1

Step 1 β€” Confirm you can manage the domain in Cloudflare

➑ What this step does

This step makes sure you have the right access before you start.

If you cannot see the domain, you cannot set up the redirect.

πŸ“‹ What to do
  1. Log in to Cloudflare dashboard.
  2. Open the account that owns the domain.
  3. Click the domain you want to configure.
  4. If you do not have access, start with Cloudflare Account Setup.
βœ… What should happen

You can open the domain settings in Cloudflare.

You can access DNS and Rules for the domain.

2

Step 2 β€” Point your domain without www to www in DNS

➑ What this step does

This step creates the DNS record the Redirect Rule needs to match.

For the example, you are pointing `yourrescue.org` (no www) at `www.yourrescue.org`.

πŸ“‹ What to do
  1. Go to DNS for your domain.
  2. Create (or edit) the record for @ (your domain without www).
  3. Type: CNAME, pointing to www (or your www hostname).
  4. Make sure the record is proxied (orange cloud) β€” Redirect Rules only work on proxied traffic.
  5. Save the DNS record.
βœ… What should happen

`yourrescue.org` has a proxied CNAME record pointing at `www.yourrescue.org`.

Cloudflare can now apply a Redirect Rule to it.

3

Step 3 β€” Add a Redirect Rule to send visitors to www

➑ What this step does

This step makes Cloudflare redirect visitors from your domain without www to your www domain.

It is a clean, no-JavaScript redirect that works for browsers and search engines, and it keeps the page path and query string.

πŸ“‹ What to do
  1. In Cloudflare, open Rules β†’ Redirect Rules.
  2. Select Create rule β†’ Redirect Rule.
  3. Under When incoming requests match, choose Wildcard pattern and enter http*://yourrescue.org/* (replace the domain).
  4. Under Then, set the target URL to dynamic: https://www.yourrescue.org/${1}.
  5. Status code: 301 (Permanent).
  6. Turn on Preserve query string.
  7. Select Deploy.
βœ… What should happen

Cloudflare shows the Redirect Rule as deployed.

Any visit to `yourrescue.org/anything` redirects to `www.yourrescue.org/anything`, keeping the path and any `?query=string`.

4

Step 4 β€” Test the redirect

➑ What this step does

This step confirms it works for real visitors.

Testing in a private window avoids cached results.

πŸ“‹ What to do
  1. Open a private/incognito browser window.
  2. Go to `https://yourrescue.org`.
  3. Confirm you land on `https://www.yourrescue.org`.
  4. Go to `https://yourrescue.org/about` (or any real page) and confirm the path carries over to www.
βœ… What should happen

The redirect happens immediately.

Your website loads normally on www, and the path/query string are preserved.

Official References

Open these only if something doesn’t match your screen.

You do not need to read them to complete the guide.

Want 4leggedIT to Set This Up?

Send us the domain you want redirected (example: yourrescue.org β†’ www.yourrescue.org), and we’ll configure the redirect safely.