Cloudflare Non WWW to WWW

How to forward non WWW to WWW on Cloudflare.

  1. Select "Page Rules" from the top navigation in Cloudflare.

cloudflare-page-rules

  1. Click the "Create Page Rule" button. create-page-rule
  2. The first field is the URL you want to match, for example example.com. You will want to enter the non WWW url with an astrisks to match any path as well. example.com/*
  3. Then from the "Pick a Setting" field you will want to select "Forwarding URL".
  4. For the "Status Code" field select "302 - Temporary Redirect".
  5. For the destination URL use the following as an example and replace the domain with yours. Don't forget the $1 at the end, this is the capture group that will carry the path from the forwarding URL. https://www.example.com/$1 page-rule-example
  6. Now Click "Save and Deploy", you may also need to clear cache. That is it, you should be good to go.

More info for non-WWW and WWW

"Non-WWW" and "WWW" refer to different ways of accessing a website. The "WWW" subdomain is a widely recognized and established way of accessing websites on the World Wide Web. On the other hand, the "non-WWW" version of a website's URL omits the "WWW" subdomain and goes directly to the root domain (e.g., example.com instead of www.example.com).

While both versions of a website's URL will lead to the same website, having both versions accessible can lead to duplicate content and confusion for users and search engines. This is why it is often recommended to redirect (or forward) the non-WWW version of a website to the WWW version, or vice versa, to ensure that there is only one preferred version of the website's URL.

Forwarding a non-WWW website to WWW can have some benefits, including:

  • Consistent URL structure: By forwarding the non-WWW version of your website to the WWW version, you can ensure that all users access your website using a consistent URL structure, making it easier for them to remember your website's URL.
  • Improved SEO: Search engines may treat the non-WWW and WWW versions of a website as separate entities, which can result in duplicate content and negatively affect your website's search engine rankings. Forwarding the non-WWW version of your website to the WWW version can prevent this issue and improve your website's SEO.

Conclusion

converting a non-WWW website to WWW can provide a more consistent and secure user experience, as well as improve search engine rankings.

about raymond ware

About Me

Hi, I am Full Stack Developer. I am passionate about JavaScript, and find myself working on a lot of React based projects.

Raymond Ware logo
©2020 Made from scratch by Raymond Ware