Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-plugin-netlify: _redirects file in static folder is not recognized #6268

tinymarsracing opened this Issue Jul 3, 2018 · 2 comments


None yet
2 participants
Copy link

tinymarsracing commented Jul 3, 2018


I'm trying to redirect the default Netlify subdomain to my primary domain as advised by Netlify for SEO purposes. In the Gatsby docs of the Netlify plugin it says:

You can also create a _redirects file in the static folder for the same affect.

So I added a file at src/static/_redirects with the content it says on the Netlify admin app:

# Redirect default Netlify subdomain to primary domain* 301!

However, after deploying if I go to the Netlify subdomain I do not get redirected to my primary domain and stay on the subdomain. What am I doing wrong?

This is the first (minor) issue I have where I didn't find any solution in the docs or in existing issues on GitHub. So, I really appreciate the great work of the community! Thanks in advance.


This comment has been minimized.

Copy link

pieh commented Jul 3, 2018

hey, if You run gatsby build locally on your machine, does generated public/_redirects file contain your custom entries? It did last time I checked


This comment has been minimized.

Copy link
Contributor Author

tinymarsracing commented Jul 3, 2018

Good idea, I forgot about that. It didn't contain the file, but the resulting public folder structure gave me an idea: My location of the static folder was wrong. After I changed it from root/src/static/_redirects to root/static/_redirects, it now works. It also says so in the docs. Not sure why I didn't see that before. :-)

Thanks and issue closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.