How to setup root Hostname redirect

I have several Subdomains that run workers or pages, and want to redirect only the root Hostname to redirect to another website. I'm not so sure how to setup this, I guess a redirect rule? But that doesn't work without proxied DNS?
6 Replies
Chaika
Chaika13mo ago
You do need a proxied DNS Record for it to work. If you just want to set up a redirect (which is an originless setup), Cloudflare recommends using 100:: (IPv6 Discard) as the record target. That is, create a new record (AAAA @ 100:: Proxied), and then create the redirect itself. There are a few ways to make Cloudflare do redirects these days, but Bulk Redirects is the best imo. There's a guide here: https://developers.cloudflare.com/rules/url-forwarding/bulk-redirects/create-dashboard/ If you just want to redirect your website to another one, then you would want a redirect like this (to preserve the path and any query strings)
Create Bulk Redirects in the dashboard · Cloudflare Rules docs
To create Bulk Redirects in the Cloudflare dashboard you must:
Kai
Kai13mo ago
thanks, I guess if I just want to redirect any URI of the root hostname to always the same URI, a normal redirect rule would be better, no?
Chaika
Chaika13mo ago
A single redirect rule? Yea, those would be easier to set up if you didn't want to keep the path. You could do the same with Bulk Redirects of course, just by unchecking preserve path suffix. Bulk Redirects are more meant for "dumb" redirects like those, and you get way more of them (Free only gets 20 items, but Pro for example gets 500), but it doesn't matter too much
Kai
Kai13mo ago
I see Thank you :)
Chaika
Chaika13mo ago
Sure, if it helps, if you wanted a simple single redirect like that, it'd be something like this
Kai
Kai13mo ago
Thank you, that's roughly what I figured. I did 302 cause I want to change it back soonish and iirc that makes browsers not cache the redirect