Issue with site being indexed on Google

Hello! Got a problem I’m not sure what to do with.

We wrote a new site from scratch and hosted it on netlify for several months whilst testing. The site is live here; http://stoic-kilby-4274cc.netlify.app/

This site eventually replaced our old site, you can see it is live here; https://www.carbmanager.com

The problem we have is that both sites are now indexed and findable on Google. This is causing issues with search rankings. We have set the canonical on every page so that it points to the correct domain.

Normally I would use robots.txt to remove a site from Google but I think in this case it would result in both sites being removed.

How can I remove the Netlify domain (http://stoic-kilby-4274cc.netlify.app/) from Google index without removing the actual site (https://www.carbmanager.com) as well?

Thank you!

In your Google Search Console and switch to the Netlify subdomain property, go to removals tab and use URL prefix to remove the URLs:

Google usually removes these URLs within 24 hours in my personal experience, but if there are a lot of pages, it might take time. You can try searching for your website (with site: prefix) to confirm that it has been removed from index. Then change your Netlify site name. This will result in the old website returning a 404 and thus, even after 180 days, Google won’t be able to see it. It will eventually be permanently dropped from index.

Additionally, if you setup a 301 redirect, that would do the trick too. Finally, you can also use the change of address option in the search console.

1 Like

@jonpreececm Just to amplify what @hrishikesh wrote, doing a redirect from your Netlify subdomain to your custom domain, along with having the correct canonical meta tags on each page, will go a long way toward resolving this issue, in my experience. Google will eventually catch up, but in the meantime you will be able to reap the rewards of search results to either URL.

Hi, @jonpreececm. The redirects rule that @gregraven mentioned would look like this (in _redirects format):

http://stoic-kilby-4274cc.netlify.app/*  https://www.carbmanager.com/:splat  301!

This forces any request for the site subdomain under netlify.app to be 301 redirected to the custom domain. It forces the domain to change while keeping the path portion of the URL unchanged.

If there are other questions about this, please let us know.