Skip to main content

Command Palette

Search for a command to run...

Netlify Redirects ๐Ÿง

Updated
โ€ข1 min readโ€ขView as Markdown
Netlify Redirects ๐Ÿง
A
Dedicated and efficient full stack developer with 8+ years of experience in application layers, presentation layers, and databases. Developed multiple web applications as a full stack developer to process, analyze, and render data visually. Worked on query optimization for the betterment of existing sections.

Today we will learn how to overcome netlify redirect issue for React web app

If you are using netlify I'm sure you face the above issue but when I'm here nothing to fear. Let's solve the issue of netlify redirect.

Now, what the issue is?? So the issue is whenever we try to access any internal route of our application directly it throws a 404-page error. Let's solve the issue.

  • Open your code editor.

  • Now go to the public folder and create a new file "__redirects".

  •     /*  /index.html 200
    

    Paste the above code in your "__redirects" file.

  • Now this redirect rule which was just added to the public folder will always serve the index.html file not a 404 page.

  • Now commit your changes and build your project for production.

  • Now revisit the link.

its working GIF


Thanks a lot for reading till the end ๐Ÿ™ You can contact me in case if you need any assistance:

Email: atul19251@gmail.com

Web: https://iamatul.netlify.app/

GitHub: https://github.com/iamrajput

LinkedIn:https://www.linkedin.com/in/atul-kumar-singh-673357102/

More from this blog

D

Dev Station

29 posts

Dedicated and efficient full stack developer with 6+ years of experience in application layers, presentation layers, and databases ๐Ÿ™‚