Issues with Google Sites and www to top level redirect

Hello there! As the title says, I’m new to Cloudflare and I’m struggling a bit to connect the service with Google Sites correctly. When adding a custom domain to Google Sites, you can’t configure the page to be located in the top-level domain: it’s always going to be at A CNAME record to www targeting was added and it works OK: when accessing it resolves and you get the website (as long as the proxy status of the record is set to “DNS only”).

What I can’t seem to solve is redirecting to so people can enter any of these URLs and get to the same page.

I’ve searched here on the forum for different solutions but I can’t seem to find one. I’ve already created an A record from “@” to the IPv4 address, and added a page rule that fowards* to$1 (301 permanent redirect). Got ERR_NAME_NOT_RESOLVED. I changed the proxy status of the A record to DNS Only, and got timed out.

I’ve even tried replacing the page rule with a redirect rule, as per detailed in other thread: when hostname equals, do a dynamic redirect with the expression concat("", http.request.uri.path) (preserve query string ticked). Same result: ERR_NAME_NOT_RESOLVED.

What would you suggest I do? Again, the www page works well, what I’m struggling with is the non-www to www redirect. Please let me know if you need more info :slight_smile:

1 Like

Thanks for posting all this information and the links! You helped me get the working for my Google sites, and I was able to figure out how to redirect to (I didn’t realize I had to disable the proxy). Here is what I have done:

My DNS is only CNAME www and the TXT record that Google added. I don’t have any records for the root.

I have 1 redirect rule. if ( eq "") then concat("", http.request.uri.path)

I waited a few minutes and it worked. On my mobile browser it seemed to do some caching and that took longer to clear up and work, but now I have both www and root working for my domain and Google sites. Happy to help more