DNS issue for domain.com and www.domain.com

When I try to go to backbeebrokenbeekeeping.com

it doesn’t work. But when I go to www.backbeebrokenbeekeeping.com it does. I need both to work and point to the same site.

I tried adding a CNAME with WWW but it states that I already have one with the same name.

Which I do, CNAME, WWW, ghs.googlehosted.com

However I need that because I am using a custom domain for my google site

Welcome the Cloudflare Community. :logodrop:

Example number one is a good choice.

1 Like

You don’t have any records for your apex domain.
https://cf.sjr.org.uk/tools/check?06b7f5d28ea14ea7b4f68cc285c8c251

To redirect it to www

In the DNS in your dashboard add an A record for @ and point it to 192.0.2.1.
https://dash.cloudflare.com/?to=/:account/:zone/dns

Go to redirect rules and set a rule which is:
When incoming requests match… hostname… equals… backbeebrokenbeekeeping.com
Then… Static… https://www.backbeebrokenbeekeeping.com

1 Like

I will try this out, allow the DNS to propogate and come back and mark this as the accepted solution if it works.

Thank you for the assistance.

Well I am not sure that it did. I cleared my cache and now it isn’t working…

There is a screenshot of my DNS settings and a redirect rule I found when researching this problem attached … if you could review them and see if it is making sense?

Also to be clear, I just want it where when people go to https://www.backbeebrokenbeekeeping.com they are redirected to https://backbeebrokenbeekeeping.com

Also I would like it where if they just type in backbeebrokenbeekeeping.com in the address bar it resolves to https://backbeebrokenbeekeeping.com

Redirect rule

The entry containing 192.0.2.1 must be proxied or the request won’t go to Cloudflare to redirect it. You have it set to “DNS only”

I have made that change, is that the only error, issue you see?

Remove the wildcards from the redirect rule (that’s only for page rules, and they are being deprecated).

Just have hostname equals www.example.com and
Static URL https://example.com

If you want to pass the request, use:
Dynamic URL concat("https://example.com", http.request.uri.path)
and check the “preserve query string” box.

2 Likes

First off, thank you so much for all the follow up help!

A couple of questions:

  1. Does the redirect look correct now?
  2. On the static URL I put the https://, but I don’t need to do that on the hostname value?

Also about how long do I need to wait to see if it is working. Currently when I try to go to: https://backbeebrokenbeekeeping.com I get the below screen

Sorry, I’ve been trying to do 10 things at once and not paying attention and got mixed up.

Your Google hosting is on www.backbeebrokenbeekeeping.com so you need to redirect backbeebrokenbeekeeping.com to that. It won’t work the other way round due to the CNAME you use.

So just change the redirect to be from backbeebrokenbeekeeping.com to Static https://www.backbeebrokenbeekeeping.com.

So this looks correct now? Do I need to wait 24/48 hours before this will work or should it be automatic?

That seems to have fixed it! Thank you so much!

1 Like

It should be immediate (and is working for me), but as you have set a 301 permanent redirect, your browser may have cached it. Restart the browser or use incognito/private mode to check.

Seems to redirect ok…
https://cf.sjr.org.uk/tools/check?8e54925f6393463286a845a210d65c93#connection-server

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.