Have you noticed that many websites these days don't use the 'www' in the URL? This updated URL structure is because the 'www' is now widely considered redundant and another extra set of characters to type into a browser address bar. In either case, you should always configure a website/URL with the https:// format to handle requests with the 'www' and here's how to do it in Cloudflare with SEO-friendly 301 redirects.
Log in to Cloudflare and select the domain to add the 301 redirect.
- Go to Cloudflare Page Rules - Rules > Page Rules. Note that you can have up to 3 Page Rules on a Free Cloudflare plan.
- Click the 'Create Page Rule' button.
- Under 'URL (required)', add your domain name in the format 'https://www.yourdomain.com/*' to the Textbox.
- Under 'Pick a setting (required)', select 'Forwarding URL'.
- Under 'Select status code (required)' select '301 Permanent Redirect'.
- Under 'Enter destination URL (required)', add your domain name in the format 'https://yourdomain.com/$1' to the Textbox
- Click 'Save Page Rule'
On creating the Page Rule, Cloudflare will redirect all https://www requests to https:// with a permanent 301 redirect. If you have any problems, check the formatting against the image below.
As a side note, World Wide Web inventor Sir Tim Berners-Lee admitted at a US technology conference back in 2009 that he felt the two slashes '///' in front of the 'www' were also unnecessary.
I could have designed it without them. A lot of paper, trees and human labour could have been saved if people hadn't had to type them.
So perhaps standard URL formatting will be https:yourwebsite.com sometime in the future. Let us know what you think about URL structures in the comments below.
Join in the Discussion