React-router auto redirect any route to root "/" except for "/main"

Instead of leaving to an empty string, you have to specify the path, which means <Redirect from="*" to="/" /> in this case.

To make the localhost:3000 to localhost:3000/, you don't have to do anything, your current code already get the job done. If you go to any website's root URL, Say http://stackoverflow.com, and try type location.pathname in console, you'll get "/"

Please ask me if you have any other problem.