Cloudflare DNS - 如何将所有子域重定向到根域?

Cloudflare DNS - How to redirect all subdomains to root domain?

有人可以告诉我如何将所有子域重定向到 Cloudflare DNS 中的根域吗?

我一直在寻找没有任何运气的一天。

不能使用.htaccess因为所有子域都没有解析(它们看起来就像一个没有传播的根域)并且没有' t return 任何东西,我不想为每个可能的子域设置数百条 DNS 记录。

我想设置一个通配符 DNS 条目来重定向或至少使所有子域都可以访问,这样我就可以通过 .htaccess 或通过 DNS 完成其余的工作。

那么如何为上述要求创建 DNS 条目?

谢谢。

来自支持:Does Cloudflare support wildcard DNS entries?

Cloudflare Free, Pro and Business plan:

We do not proxy wildcard records so these subdomains will be served directly without Cloudflare performance, security, or apps. The wildcard domain will have no cloud (orange or grey) on the Cloudflare DNS Settings page for that reason. If you are adding a * CNAME or A Record you need to make sure the record is grey clouded in order for the record to be created.

To get Cloudflare protection on a wildcard subdomain (for example: www), you explicitly have to define that record in your Cloudflare DNS settings. First, log into your Cloudflare account and select the DNS icon. In this example, you would add "www" as its own CNAME record on your Cloudflare DNS Settings page and toggle the cloud to orange so the Cloudflare's proxy is enabled.

除非您是企业客户,否则您不能使用通配符通过 Cloudflare 进行重定向。

确保云标识为灰色以添加通配符记录: