Delete Default subdomain

Hi!

I have a concern about my netlify default subdomain. I’ve already pointed my netlify to my domain but I still can get into my default subdomain.

I guess it can affect SEO because is duplicate content. So, what is the best solution for that? Remove the default subdomain or redirect?

Can someone tell me what is the best option and how to make it?

Thank you!

If I understand your question, there are two things you can do.

  1. Put a link on your webpages that specify the canonical URL for the content, and
  2. Add a link to your _redirects file that is something like this:
# Redirect default Netlify subdomain to primary domain

https://domain.netlify.app/* https://www.domain.com/:splat 301!
1 Like

Hi @gregraven, thank you for your response! One question, how and where should I create the _redirects file? It’s this inside the Gatsby project?

@jotafelix I don’t use Gatsby, but my guess is that you would create it as a static file in such a way that it would wind up at the top level of your website after the build process.

Hey @jotafelix,
You should actually be set already: if you use a custom domain and don’t already have rel="canonical" links in your HTML, then Netlify adds a special header to tell crawlers what the canonical URL is and to ignore the Netlify subdomain. More on the feature here:

Wanna have a look and let us know if you have any questions?

Hi @jen, thank you for the response! Yes I checked on my Netlify subdomain and it’s pointing to my canonical URL.

I have a question, what means inside the canocical link the following?
data-baseprotocol=“https:” data-basehost=“www.felixdigital.es”

data-baseprotocol and data-basehos, it’s normal?

Thanks! :blush:

Hey @jotafelix, I’m not sure where you’re seeing those parameters. Can you please post a screenshot and then I can try to get you some answers?

@jen I attach a screenshot, please check out,

Hey @jotafelix,

For a Gatsby site, these are perfectly normal. I’m sure other SSGs may do something similar :smile:!

Hi @Scott,

Thank you very much! yes, it seems normal! :slight_smile:

Hey @gregraven!

I did this, but my SEO is bad. What do you think?

Hey @LimaBruno,
Did you see this post?

If you’re seeing something different, could you please share your Netlify URL so we can take a look?

Hi @jen

The redirect seems to work. I had forgotten the exclamation point “301!”. But my SEO is still very bad