title: react router v4 dployment on ec2 return 404
body: <p>My local React &amp; Node.js app is working locally, but all React routes are failing on the server.</p>
  
  <p>On the server (aws) index.html would show, and I also receive positive feedback trying to authenticate with user &amp; password (so I assume all is fine with node.js routes).
  but all the React Router inner paths  would "404".</p>
  
  <p>the main React routing page look like this:</p>
  
  <pre><code>import { Redirect, BrowserRouter as Router, Route, Switch } from 'react-router-dom'
  
  render() {
      return (
        &lt;Router&gt;
          &lt;Switch&gt;
            &lt;Route exact path='/' render={() =&gt; (&lt;Login setRedirect={this.setRedirect} /&gt;)} /&gt;
            &lt;Route exact path='/edit-menu' component={EditMenu} /&gt;
            &lt;Route path='/view-menu/:rest_id' component={ViewMenu} /&gt;
          &lt;/Switch&gt;
        &lt;/Router&gt;
      );
    }
  </code></pre>
  
  <p>after successful login the page will forward to:
  <em>serverhostname</em>:8081/edit-menu (as on localhost)</p>
  
  <p>I would expect the hostname/edit-menu to show to component of EditMenu, as it does on localhost, but returns "404" on the server.</p>
  
  <p>Git: <a href="https://github.com/Yanipo5/MenuCreator" rel="nofollow noreferrer">https://github.com/Yanipo5/MenuCreator</a><br>
  Note: I red <a href="https://stanko.github.io/react-router-subfolder-on-server/" rel="nofollow noreferrer">https://stanko.github.io/react-router-subfolder-on-server/</a>
  and it says it relates to the dev server trying to map routes to the root directory???? not sure but any way currently my server project structure is (root &lt;- ec2-user &lt;- myProjectDirectory)</p>