How to set the domain for CloudFlare so it won't direct the prefix of www

G-d willing

Hello,
I am having a WordPress website which is using an SSL certificate.
The website is configured not to use the www prefix and it is https://domain-name.com.
Currently, the CDN is directed to https://www.domain-name.com. So how can I configure the CDN to work with the non www address.
The website is hosted with SiteGround and I am using the free CDN package.

Thanks,

The easiest way would be not to configure a DNS record for www. Alternatively you can also use a page rule to redirect to the naked domain.

First, thank you very much for your response.
And how do I do what you said?
How do I remove the configuration for the DNS record of www?
Also, how can I set a page rule to redirect the naked domain? Is it thru WordPress…?

Thanks again for the answer.

You open the DNS settings in your Cloudflare control panel and delete the respective record.

But keep in mind, in this way your site wont be reachable under www. If you still want it reachable you set up a a page rule. Have a look at Cloudflare’s help centre for a detailed walkthrough.

G-d willing

Thanks again for the answer.
It is really helping me.
I do have a question about the page rule I need to create.
I must say that I am totally new to all this CDN thing and also (of course) to these page rules.
I read this support page: https://support.cloudflare.com/hc/en-us/articles/218411427
And want to do a redirect as I was advised.
So for the first field “If the URL matches” I typed:

www.domain-name.com/*

I typed the asterisk sign before and after the value - just the post here does not show it since it is the shortcode for “Bold”
As for the rule settings I choose:

“Forwarding URL”

And for the destination URL, I typed:

domain-name.com/*
Also here, I typed the asterisk sign before and after the value - just the post here does not show it since it is the shortcode for “Bold”

Is it okay?

The match seems to be alright, however for the destination you’d like https://domain/$1

G-d bless you for the rapid response.
thank you very much my friend.
I am setting the rule as permanent, right?
I don’t see a reason why it be temporary.

Thanks again!

If it is unlikely you ever want to use www you can do that. Otherwise temporary might be possibly better as it can be sometimes tricky to get “rid” of a permanent redirect as they are typically cached and it can take some while for that to expire.

Thank you very much my friend.
I really appreciate it.
Currently I set it to permanent. Hope it will do the job well.

I have just noticed that no matter what I type after the domain name, it is always returning the domain name only without the rest.
For example if I want to go to the “www.domain-name.com/contact-us” I am being redirected to “https://domain-name.com” only without the contact us.
How can I fix this?
I have uploaded a screenshot of how the rule looks like.

Thats because you have two asterisks. Remove the first and $1 should match.

I am sorry but I didn’t get you on this one.

Simply remove the * in front of www :slight_smile:

Thank you very much, it is working now.
G-d bless you for the help

This topic was automatically closed after 31 days. New replies are no longer allowed.