Correct file location for redirects file - redirects not working as expected


I want to redirect to my domain

As per the documentation, I have added _redirects file to the root folder of my site domain. But it isn’t working, not sure about the reason.

Is there any way to redirect both the URLs.

FYI: My github pages site is on Netlify CMS.

What are the contents of the _redirects file?

Here it is:

These rules will change if you change your site’s custom domains or HTTPS settings

Redirect default Netlify subdomain to primary domain* 301!

Looks fine to me. Is it possible for you to share the link to your repo? May be you have filename wrong or incorrect format etc.

sure, here it is:

You need to put _redirects file in site/static/ directory. That way after build it’ll end up in root of your published site.

1 Like

Oops, my bad. Thanks for your help.

Redirect is not working after doing the same @rootkea
And one thing more, I don’t know why but when I make some changes on site like “adding the title tag for SEO”, it’s not reflecting when i commit from the repo. Do you know the reason behind it?

@rakshitsoral, looking at your currently published deploy, you don’t have a _redirects file. When you build the site locally on your own machine does the _redirects file exist in the root of your publish directory?

1 Like

_redirects file is in the admin folder. But I have found the reason behind it. It seems that my deploys have failed that’s why there are no changes made live. I have raised the question here in the forum.

Here’s the link to failed deploy:

So we can keep the forum organized I won’t respond in this thread about the build errors :wink:

However, the _redirects file must end up next to your index.html in the root of your build directory when your build completes (in gatsby’s case, it will move the files in static to that folder for you :))

We do NOT read it from anywhere else.