Search code examples
reactjsslugsanity

Sanity Slug works in localhost but not on Netlify


So I am building a react and sanity blog website. When I run the app on localhost, my blog post slugs work, copying the slugs and opening in a new tab works but when I deployed it on Netlify, I get a 404 page, what going on?

Thank you for your time


Solution

  • Try this, it worked for me

    In your public folder, create a "_redirects" - without the quotes, file and add the following lines of code

    /*  /index.html  200
    

    Hope it works for you.