Skip to main content

Auto Redirect Root Domain to www

d
Written by dhru soft
Updated over a week ago

If your subdomain is www, you must redirect the root domain to www.

Example:

Cloudflare

Open Cloudflare Dashboard → select your domain

Go to Rules → OverviewCreate rule (Redirect Rules)

When incoming requests match

  • Wildcard pattern

    • Request URL: https://example.com/*

  • Target URL: https://www.example.com/${1}

  • Status code: 301

  • Preserve query string: Enabled


Save & Enable

This ensures all root-domain traffic automatically redirects to www.

Did this answer your question?