Vite.js React Build Not Redirecting On Netlify And Vercel

I made a react build with vite.js.
When building for production and testing on local host all is working fine. But when i deploy to Netlify or vercel routes that i created with react-router are not accessible via entering their url directly, but only from the main page (‘/’) via using the links inside of the application.