I’ve just noticed that the netlify.app and netlify.com subdomains are appearing google search results, even though I have a _redirects file that 301 redirects to the primary domain. Is there any reason for this? The redirects work, but the results are still showing in Google. One site has had the redirects for 9 months - so crawl time shouldn’t be an issue here right?
EDIT: Also, with the new subdomain url changes, do I need to redirect both .netlify.com and netlify.app or only netlify.app to my primary domain?
Hey @webbrewjake we’ve had a look at this internally, and this subdomain atop our netlify.com domain cannot be manually “Requested for Removal” within the tooling we have at our disposal.
This content/subdomain technically no longer lives on our .com domain, hence we’re unable to request removal from search engines of this non-existent property. In due time, googlebot (and other search engine crawlers) will continue to follow the 301 redirect to your subdomain atop our netlify.app domain and then remove the .com subdomain reference altogether, on its own.
Submit sitemaps and otherwise have control to manage your domains accordingly, going forward
I’m noticing some other, outdated .netlify.com references in-the-wild (https://www.facebook.com/hamiltonmassagecompany/posts/and-with-that-my-website-is-live-im-really-excited-to-have-this-up-and-running-o/479873989492107/), so it’d be worth your time to search around (https://www.google.com/search?rlz=1C5CHFA_enUS875US875&ei=oLm1XqWiNdHT-wSzkYGoDw&q=Hamilton+Massage+Company+Sports+%22netlify.com%22&oq=Hamilton+Massage+Company+Sports+%22netlify.com%22&gs_lcp=CgZwc3ktYWIQAzoFCCEQqwJQmSVYuydgqSloAHAAeACAAU-IAd4CkgEBNZgBAKABAaoBB2d3cy13aXo&sclient=psy-ab&ved=0ahUKEwil8tu9hqXpAhXR6Z4KHbNIAPUQ4dUDCAw&uact=5) and update those, as well.
This Facebook example, in particular, and discrepancy in post content versus attached social card domains referenced is likely due to caching (use FB’s open graph debugger tool to re-fetch open graph content) and/or combination of social meta tags (<meta property="og:url" content="">) needing optimized.
Obviously there’s a redirect chain from .com > .app > your custom domain, but it is resolving correctly at your custom domain eventually. Understand the concerns here and hopefully this helps with some guidance and next steps you can take from your end. Best of luck!
Regarding the Google Search Console stuff - I have the actual domain in there already, and have submitted sitemaps succesfully in the past. It’s my understanding I won’t be able to add webbrew-hmc.netlify.com as a domain property because I can’t verify that domain because I don’t own it, so therefore I can’t request removals that way? If the subdomain no longer lives on your .com domain, then who owns it?
Hi, @webbrewjake, the subdomain does still exist under our .com domain. Both netlify.com and netlify.app are still registered by our company. No content is served from the domain and it only returns 301s at this time.
You can also avoid having the subdomain indexed even a first time. There are instructions about how to do this here:
If these headers/tags are used you can prevent Google from indexing until you have the site published at the domain of your choosing. This will prevent the Netlify subdomains from being indexed in the first place.
Now, that the indexing has occurred, the un-indexing becomes more complicated. If there are other question, please let us know.
(All sites are HTTPS at Netlify so this is why both HTTP and HTTPS redirect to HTTPS above.)
Finally, yes, you can do netlify.toml and/or _redirects. I prefer the _redirects file as the syntax is simpler but that is only my personal preference. You can use either one (or even both at the same time with some rules in netlify.toml and other rules in _redirects).
Again though, I would personally just stick with _redirects and the 301! rules above.
If there are other questions, please reply anytime.
Hi, @andylemaire. In order to troubleshoot, we need to know what site this isn’t working for. Would you please share the site subdomain or site API ID with us?
Hi, @andylemaire. I’m showing the redirects look like this:
[[redirects]]
from = "https://andylemaire.netlify.app"
to = "https://<custom domain here>"
status = 301
force = true
[[redirects]]
from = "https://andylemaire.netlify.com"
to = "https://<custom domain here>"
status = 301
force = true
This works when the path is just / and the 301 redirect is returned:
The solution for this is to add two more redirects, the ones below:
[[redirects]]
from = "https://andylemaire.netlify.app/*"
to = "https://<custom domain here>/:splat"
status = 301
force = true
[[redirects]]
from = "https://andylemaire.netlify.com/*"
to = "https://<custom domain here>/:splat"
status = 301
force = true
If you add those two redirects to the existing redirects above, anything not using the custom domain will get redirects. As it stands now, though, until those two redirects above are added direct links to anything other than the / path will return the content and a 200 response.
If that doesn’t work or if there are other questions, please let us know.
Well my actual question is if there’s a possibility to only translate part of a path in the url.
Like using wildcards in a rewrite. something like from = "*/example/*" to = "*/new-example-path/*"