I’ve launched a new website. Now I added the CNAME records to my hosting provider.
www CNAME example.netlify.app
Now my question is, Does google index example.netlify.app, when the APEX domain is example.com?
example.netlify.app and example.com will be in sync I guess?
I only want example.com indexed but not example.netlify.app.
I’ve developed on example.netlify.app, now I’ve set up the custom domain (from the hoster I point to netlify with CNAMEs), and can reach the site with example.com.
Now I can access the site with example.com but also still with the “old” subdomain example.netlify.app.
Since both serve the same files, how to just noindex example.netlify.app?
example.netlify.app and example.com is the same site.
Now I get it. Well, then I guess you’d have to try using headers. You’d have to add a header to your subdomain. Something like this in your _headers file:
Let me short circuit the conversation here — Netlify will automatically send back a canonical Link header for any site that is using a custom domain but which receives a request at their ___.netlify.app automatically-assigned domain. You don’t need to do anything on your end.
If you want even more redirection, you can setup a custom redirect that would look like (toml format):
[[redirects]]
from = "https://jonsully.netlify.app/*"
to = "https://jonsully.net/:splat"
force = true
To force all traffic to your primary domain in the first place. This is what I do for my site (example above is live), but it’s unnecessary and does not impact SEO one way or another thanks to Netlify automatic Link header.
Hope that helps
–
Jon
P.S. I adjusted this post’s title to better fit / clarify the use-case for future searchers
I think that may just be a writing style thing. I believe David wrote with the intention of:
“When you add a custom domain, you’re serving the same content on two domains - bad for SEO”
“Option 1: you can use _redirects to shove all traffic to your main domain”
“Option 2: you can add your own canonical meta tags to your HTML”
“Since option 2 is better but we don’t want to force everyone to have to wire up canonical tags, we’re going to automatically do this for you as a Link header”