Redirecting www to non www

Cloudflare with Flexible SSL

Before integrating Cloudflare, my website was redirecting from www to non www version. Now it’s showing DNS error. I have added only A record to Cloudflare DNS.

I have created a page rule - Forwarding URL -* to

Still it’s not working.


Hey again :smile:

I just tested your scenario. Pretty sure you will need to create a CNAME record www for this to work.

1 Like

Hi thanks Andy. Trying to contribute towards secure web :wink:

Just added a CNAME
Name : www
Value :

Still not forwarding. Will it take time?


It may take some time, yes. Also try clearing your cache. Your Page Rule syntax may also be an issue (not sure). Check out this article for more info on syntax:

You mentioned you are using Wordpress in your other post. If you’re on Apache you could do this with mod_rewrite in your .htaccess (assuming you have access to your origin server) and save the Page Rule for something else…


I used some page rules to do the same.
Make sure the rule you wrote is correct. For example, if you are also using https you will need more than one rule (I did it with three).

1 Like

I agree, if he can edit .htaccess he’d better save the page rules.
I used the page rules because, for that website, I couldn’t edit .htaccess.

1 Like

Yes, it was. I added $1 to the forwarding URL, as explained in the article. Now it’s redirecting :slight_smile:

Now the problem is it’s redirecting all www URLs to home page.

Yes using WordPress for blog (in subfolder), but can’t access server (.htaccess). The main site is in Asp.Net.

Can you please tell the rules required. Thanks.

1 Like

Well, mine is working now with only one page rule :slight_smile: Maybe it needed some time, I purged the cache also.

1 Like

Glad you got it sorted. Page Rules are valuable, so good you were able to get it working with just 1.

On that subject, since you are running Wordpress, it’s advised to create a Page Rule for wp-admin area to bypass cache.

This video is pretty helpful (wish I had found it earlier) and covers the wp-admin page rule ~3:30 mark (along with some other tips):


Yes Indeed it’s very helpful. One thing not able to get is when we have the option of “Always use HTTPS” under crypto then why we need to use one page rule to always use https. I am not using any page rule for this. Am I missing something?

Forwarding URL -* to$1

1 Like

There’s no need for a page rule now that the Always Use HTTPS function is available. The video is just a little outdated.

1 Like

Unfortunately that is the case. Always use HTTPS was a very popular page rule that we wanted to make sure people were aware of (so we mention it a lot). We were eventually able to build it into the interface to make it even easier, but now are still going back and cleaning up the more confusing references.

1 Like

@ryan could you please confirm that the syntax used in a message up here,$
($ without a number) is correct? I have read all the examples in the documentation, and they only use $1, $2, etc.

Wow, I didn’t know that Always Use HTTPS had been added to the interface. Great way to save at least a page rule… thank you for the tip!

There needs to be a number associated with the $ or else it won’t match/replace correctly.

As expected. Thank you for the confirmation.

1 Like

Typo mistake, it’s $1. Corrected.

Hi Andy, bothering you again. Are you absolutely sure this is required? While reading more about CNAME, found that the purpose is different.

Isn’t the forwarding page rule enough for the redirection? In my case, maybe it was just cache purge required and after some time it start working.