Root Domain "naked domain" doesn't redirect to www subdomain properly

Refer to my post from quite a bit ago: https://community.cloudflare.com/t/redirect-root-domain-to-google-sites-website/

I am trying to use the redirect rule with a custom filter expression. The “if” being hostname equals domain.com
While the “then” being type static url www.domain.com status code 301

I used a third party website and it works like a charm, but guess what? Why would I trust a third party? How am I supposed to know if they will stay up for long?
Please for the love all holy, may someone help me with this because I can’t find a single source that helps my issue.

Hi,

As long as your naked domain has a DNS record that is proxied :orange: by Cloudflare, you can use a Redirect Rule by following example 1:

2 Likes

With how Google Sites works, I cannot have the DNS record proxied.

How Google Sites works is completely irrelevant if you want to set up a redirect.

Also, it’s news to me that you cannot proxy your Google Sites website.

I guess it is news to you:


This image shows what happens when I make the CNAME record for Google Sites proxied.
Also, the previous user stated that I need to have a proxied record.

That’s not an issue with proxying. It’s a mismatch between the site and your Cloudflare settings. If you posted domain name, we’d be able to narrow it down.

So you’re telling me if I get help with the proxying of the record, I would be able to make a redirect to the subdomain? Also is there a way of me private messaging you so I don’t have to share the website here?

Any Cloudflare performance or security feature depends on Cloudflare receiving the traffic for a domain. That requires an A, AAAA, or CNAME DNS record set to :orange: Proxied.

So, for a redirect to work, you need a proxied DNS record for the redirect-from domain. It could be as simple as having a CNAME pointing to the redirect-to domain.

3 Likes

Well, the problem I have is, when I make the DNS record proxied, you can’t connect to the site.

Why? What error do you encounter?

1 Like

The record that need to be proxied is the one you want to redirect. That’s the root domain right?

Your screenshot is of www. That doesn’t need to be proxied for a redirect rule on the root domain to work.

2 Likes

So basically, I’m using Google Sites. My www subdomain redirects to ghs.googlehosted.com and I have a TXT DNS record that verifies my domain with Google Sites so it can let me have the subdomain redirect to the website. When I try to forward the root domain, I can’t access the page. I done it where I had made the www subdomain record proxied and not proxied and I still can’t access it. This is what I get:


This is the setup I have when trying it with a page rule:

I’ve also tried a redirect rule:

Heres the DNS Setup too:


image

I don’t even know how I haven’t found anything related to this on Cloudflare

You appear to lack a valid record for your www server. Check the google instructions again. A TXT record does not tell a web browser how to get to a server hence the NXDOMAIN error in your first screenshot.

If it doesn’t work when you type in the www it isn’t going to work when you type in the root domain and forward to a record that doesn’t work by itself.

Add the records Google requires and get the domain you have set up working. Then worry about a filling the Cloudflare instructions on a forwarding rule.

3 Likes

The www subdomain works fine, I’m just trying to redirect the root but I get that error when typing it.

You still don’t have a DNS record for the root.

Try this (with the actual domain name), and make sure it’s :orange: Proxied:

2 Likes

Should I have that record while have the redirect rule set? Or turn that rule off?

2 Likes

This helped and so did a canonical redirect also help.

2 Likes

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