Netlify.app and netlify.com subdomains are showing in Google search results

Hey there,

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?

Thanks,
Jake

hey jake, can you tell me which domain / site(s) this is regarding? We might be able to pull a lever to help you. thanks!

Hey Perry,

Thanks for taking a look at this. The subdomain appearing in Google search results is webbrew-hmc.netlify.app and webbrew-hmc.netlify.com

Cheers,
Jake

thanks, jake. we’ll look into it and get in touch if we have more information for you :muscle:

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.

Worth a shot from your end:

  1. Signup for Google Search Console
  2. Add domain properties you’d like to manage
  3. Go through DNS TXT record or other verification
  4. 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!

Hey Scott,

Appreciate your explanation for this.

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?

Thanks!
Jake

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.

1 Like

Hi, @anon6271552, this all looks correct. The only change I would make is to force the 301 redirect by using 301! in place of just 301.

Yes, I would recommend two rules, one for both HTTP and HTTPS, so this (which also includes the 301! change):

https://example.netlify.app https://example.com 301!
http://example.netlify.app  https://example.com 301!

(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.

I have the same issue, after quite some time (months) they are still being indexed even though I have the redirects with 301!.

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 @luke , it’s andylemaire.

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:

$ curl --compressed -svo /dev/null https://andylemaire.netlify.app/  2>&1 | egrep '< HTTP'
< HTTP/2 301

However, if someone visits a path other than /, for example /contact the redirect doesn’t apply and the 200 response is returned:

$ curl --compressed -svo /dev/null https://andylemaire.netlify.app/contact  2>&1 | egrep '< HTTP'
< HTTP/2 200

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.

2 Likes

Hi @luke thanks for your answer!
Does this also works for paths without domain? For example

[[redirects]]
from = "/contact/*"
to = "/contact-new/:splat"
status = 200

Hey @andylemaire,

Is this in relation to the issue being discussed before, or are you simply confirming if that redirect would work fine?

Hey @hrishikesh,

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/*"

Oh, no that won’t be possible. You can use parts after the domain like:

https://www.example.com/foo/bar/xyz

Here, it’s possible to extract foo and bar separately. Not otherwise.