<Router>
<Routes>
...
<Route path="*" element={<PageNotFound />} />
</Routes>
</Router>
//you can do this only with react router dom
//just do this
<Route path="*" element={<ErrorPage/>} />
<Route path="" element={<ErrorPage/>} />
<Route element={<ErrorPage/>} />
//* in react router dom mean 404 error page
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>