I'm trying to figure out if it's possible to detect URLs with capital letters and redirect them to the same URL with all lowercase letters.
So, something like '/products/Top/' would be redirected to '/products/top/'.
Is something like this possible with react-router-dom in React Router v4?
Figured it out:
<Route sensitive
path="/:slug1*:slug2([A-Z]):slug3*/"
render={props => <Redirect to={`${props.location.pathname.toLowerCase()}`}/>}/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With