title: Apache virtual host .htaccess and react router
body: <p>I am running a windows 10 machine with apache 2.4. I am trying to deploy my website to my apache webserver but the routes are not working.</p>
  
  <p>For example, when I go to <a href="http://my.domain.com/" rel="nofollow">http://my.domain.com/</a> I see the website root. But when I try to go to <a href="http://my.domain.com/users" rel="nofollow">http://my.domain.com/users</a> I get a 404 error.</p>
  
  <p>I am using a virtual host to run my website so it doesn't interfer with mine main domain. </p>
  
  <p>Here are my settings:</p>
  
  <p>React redux routing:</p>
  
  <pre><code>ReactDOM.render(
    &lt;Provider store={store}&gt;
      &lt;Router history={browserHistory}&gt;
        &lt;Route component={App}&gt;
          &lt;Route path="/" component={HomePage} /&gt;
          &lt;Route path="/users" component={UsersPage}/&gt;
          &lt;Route path="/user" component={UserPage}&gt;
            &lt;Route path="/user/:id" component={UserPage}/&gt;
          &lt;/Route&gt;
          &lt;Route path="*" component={NotFoundPage}/&gt;
        &lt;/Route&gt;
      &lt;/Router&gt;
    &lt;/Provider&gt;,
    document.getElementById('app')
  );
  </code></pre>
  
  <p>.htaccess:</p>
  
  <pre><code>RedirectMatch ^/oauth2/redirect/(.*)$ $1
  
  &lt;ifModule mod_rewrite.c&gt;
  
  
    #######################################################################
    # GENERAL                                                             #
    #######################################################################
  
    # Make apache follow sym links to files
    Options +FollowSymLinks
    # If somebody opens a folder, hide all files from the resulting folder list
    IndexIgnore */*
  
  
    #######################################################################
    # REWRITING                                                           #
    #######################################################################
  
    # Enable rewriting
    RewriteEngine On
    RewriteBase /
  
    # If its not HTTPS
    # RewriteCond %{HTTPS} off
  
    # Comment out the RewriteCond above, and uncomment the RewriteCond below if you're using a load balancer (e.g. CloudFlare) for SSL
    # RewriteCond %{HTTP:X-Forwarded-Proto} !https
  
    # Redirect to the same URL with https://, ignoring all further rules if this one is in effect
    # RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R,L]
  
    # If we get to here, it means we are on https://
  
    # If the file with the specified name in the browser doesn't exist
    RewriteCond %{REQUEST_FILENAME} !-f
  
    # and the directory with the specified name in the browser doesn't exist
    RewriteCond %{REQUEST_FILENAME} !-d
  
    # and we are not opening the root already (otherwise we get a redirect loop)
    RewriteCond %{REQUEST_FILENAME} !\/$
  
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteRule ^ - [L]
  
  
    # Rewrite all requests to the root
    RewriteRule ^(.*) /
  
  &lt;/ifModule&gt;
  </code></pre>
  
  <p>httpd-vhosts.conf</p>
  
  <pre><code>#
  # Virtual Hosts
  #
  # If you want to maintain multiple domains/hostnames on your
  # machine you can setup VirtualHost containers for them. Most configurations
  # use only name-based virtual hosts so the server doesn't need to worry about
  # IP addresses. This is indicated by the asterisks in the directives below.
  #
  # Please see the documentation at 
  # &lt;URL:http://httpd.apache.org/docs/2.2/vhosts/&gt;
  # for further details before you try to setup virtual hosts.
  #
  # You may use the command line option '-S' to verify your virtual host
  # configuration.
  
  #
  # Use name-based virtual hosting.
  #
  NameVirtualHost *:80
  
  #
  # VirtualHost example:
  # Almost any Apache directive may go into a VirtualHost container.
  # The first VirtualHost section is used for all requests that do not
  # match a ServerName or ServerAlias in any &lt;VirtualHost&gt; block.
  #
  &lt;VirtualHost *:80&gt;
      ServerAdmin myemail@nbnet.nb.ca
      DocumentRoot "D:/my.domain.com"
      ServerName my.domain.com
      ServerAlias mystify.homenet.org
      ErrorLog "logs/my.domain.com-error.log"
      CustomLog "logs/my.domain.com--access.log" common
      &lt;Directory "D:/my.domain.com"&gt;
          Options FollowSymLinks
              AllowOverride All
              Order allow,deny
              allow from all 
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      ServerAdmin myemail@nbnet.nb.ca
      DocumentRoot "D:/my.domain.com/lln4"
      ServerName lln.domain.com
      ErrorLog "logs/lln.domain.com-error.log"
      CustomLog "logs/lln.domain.com-access.log" common
      &lt;Directory "D:/my.domain.com/lln4"&gt;
          Options FollowSymLinks
          Options All
          Include D:/my.domain.com/lln4/.htaccess
              AllowOverride All
              Order allow,deny
              allow from all 
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>anyone have any idea why the sub pages of my website arn't working?</p>