SEO Default Subdomain X Primary Domain

Hey guys!

I’m using the standard Gatsby template “gatsby-starter-default” with primary domain and I have a bad SEO. The Default subdomain ( has a good SEO. How can I redirect SEO Default subdomain to the Primary domain?

What I’ve tried to resolve the conflict:

1st - I installed the Gatsby plugin “gatsby-plugin-canonical-urls” and configured the primary domain (gatsby-config.js).


      resolve: `gatsby-plugin-canonical-urls`,

      options: {

        siteUrl: ``,



2nd - I created the “_redirects” file:* 301

Deploy summary:


I’m using the MozBar SEO plugin, look at the metrics it’s still in the default domain!

Default subdomain

Primary domain

How can I solve this?

Hey @LimaBruno :wave:t2:

I don’t have that plugin for SEO testing, but using shows that your gatsby-plugin-canonical-urls is working - the HTML meta tag is in place and the SEO tool is reading that.

That should do it as far as canonical-urls are concerned with SEO!

That said, I don’t see your redirects actually running. Where do you have your _redirects file in the context of your site folder structure?


Is that repository up to date? There’s a lot happening in your latest build that is not accounted for in that repository. I don’t see a netlify.toml or anything :thinking:

Yes it is updated with github. I didn’t understand how to use the netlify.toml file. How can i use it?


Why do you say?

There’s a lot happening in your latest build that is not accounted for in that repository.

I’m sorry, I didn’t understand :face_with_raised_eyebrow:

An example would be that your build is using build-plugins which is a feature that, as far as I know, only works when you are using a netlify.toml file. How are you using build plugins?



I don’t know if I understood it very well, but … If these plugins are from Netlify I just installed and did not configure the netlify.toml

Ah, that’s on me - I haven’t used Plugins outside of declaring them in the netlify.toml file, but it appears yes you can install them on a site without having the toml file :thinking:

As for the issue with your _redirects not working, I think you just need to change the 301 to a 301! (add an exclamation point) - the behavior you’re seeing, where the page is loading on that domain even though you have a redirect defined is called shadowing and worth reading about. Any time we want to push to the primary domain from an alias, we need to force the redirect (with exclamation mark) to ensure that the shadowing effect is ignored

@jonsully :smiley:

How are you? I put the exclamation point (301!) and is redirecting to the primary domain, but I don’t understand why my SEO is bad. I also use the Google Search Console

hi @LimaBruno, when you say your “SEO is bad” what do you mean exactly? Also - none of us here are really SEO experts, although we can try to give general advice :slight_smile: