I have an Angular SPA that I would like to deploy with Netlify. My site goes live like a charm but when I hit refresh on any page it redirects to Page Not Found. I have read the documentation where it claimed I should use redirects since I use Angular Routing in my app.
So I have created a _redirects file in my src folder with /* /index.html 200 in it that should navigate all route to the index file so the Angular Router could handle the rest, and I added "src/_redirects" to my angular.json/assets array.
But when I check to Deploy Summary I see that No redirect rules processed. Am I missing something?
Hi, @Hordon13, and welcome to our Netlify community site. I was going to recommend that exact solution:
Seeing as you have already done this, it might help to examine the build itself. Would you please send us a link to the site at Netlify? (Meaning a URL starting with https://app.netlify.com/sites/?)
My best guess is that the file isn’t being copied by Angular to dist and examining the build itself would be the first step in troubleshooting why not.
Thanks, that is exactly what I was looking for. That site has no redirects applied, so no surprise they don’t work Please make sure your _redirects file ends up next to index.html after building so we see and deploy it !
I don’t think your site generator needs to know about it - you just need to deploy that file next to index.html to “activate” it.