问题原文
原帖链接 · Imran Zahoor · CC BY-SA 4.0
Is it possible to redirect example.pages.dev to example.com using Cloudflare's DNS dashboard or pages?
So basically what I want is if someone visits example.pages.dev, the person should be redirected to example.com.
Note: example.com is pointing to example.pages.dev via CNAME entry inside Cloudflare's DNS dashboard already. Please also note that example.pages.dev is generated by Cloudflare's pages and is not in our control.
Please also clarify if Google will index the pages as duplicate? Because they'll be accessible from the URL generated by Cloudflare Pages on sub-domain and they'll also be available on main domain.
Will Google indexing these two pages and detect them as duplicates?
example.com/some-pageexample.pages.dev/some-page
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
A similar question has been asked and answered in the Cloudflare pages forum: Cloudflare Pages, custom domain - General - Cloudflare Community.
The answer as of July 2021 was that functionality for hiding the pages.dev domain by redirecting to the custom domain isn't available. Instead you should use rel canonical link tags in the head of every page of your site to tell search engines which of the duplicate URLs is your preferred URL.
Having your site available on an alternate domain shouldn't hurt your SEO, especially if you use canonical tags. When Google encounters duplicate content it typically chooses one of the two duplicate URLs to index and ignores the other. With canonical meta tags, you can ensure that Google chooses the correct variant. See What is duplicate content and how can I avoid being penalized for it on my site?
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
