title: How to setup apache server for React route?
body: <p>I have my react app running great on my local dev server but it did not work when I  dump my production ready files straight into Apache's htdocs directory:</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>/var/www/index.html
  /var/www/bundle.js
  </code></pre>
  
  <p>and I have </p>
  
  <pre><code>DocumentRoot /var/www
  </code></pre>
  
  <p>in  /etc/apache2/sites-available/000-default.conf</p>
  
  <p>The fact is that <br/>
  1). when I access <a href="http://...com/" rel="noreferrer">http://...com/</a> that routed me to Login page<br/>
  2). After I clicked a link </p>
  
  <pre><code>&lt;Link to="main"&gt;&lt;button&gt;Log In&lt;/button&gt;&lt;/Link&gt;
  </code></pre>
  
  <p>the content in the browser location field become:</p>
  
  <pre><code>http://...com/main
  </code></pre>
  
  <p>3). Now if I reload this url (<a href="http://...com/main" rel="noreferrer">http://...com/main</a>), I got</p>
  
  <pre><code>The requested URL /main was not found on this server
  </code></pre>
  
  <p>My rounting in React:</p>
  
  <pre><code>    &lt;Router history={browserHistory }&gt;
        &lt;Route path="/" component={TopContainer}&gt;
            &lt;IndexRoute component={Login} /&gt;
            &lt;Route path='main' component={MainContainer} /&gt;   
        &lt;/Route&gt;
  &lt;/Router&gt;
  </code></pre>
  
  <p>What else I am missing in the apache configuration?</p>
  
  <p>thanks</p>