title: How to activate the history mode of the vue-router on a subrout of a website written in php, apache server?
body: <p>I am including a SPA on my website in apache server, but when accessing the route of this, I load the views but the route returns to the main domain. How should I configure the router or <code>.htaccess</code> to correct this?</p>
  
  <p>My website is like <code>www.example.com</code> , and the Vue SPA is located in <code>www.example.com/en/route1/route2/spa</code>.</p>
  
  <p>When I access this route, the Vue SPA loads but the route returns to the main domain <code>www.example.com</code>, and the Vue SPA routes loads as usual but in the main domain route, like <code>www.example.com/spa/spaRoute1</code>.</p>
  
  <p>What I want is to preserve the original route of the Vue SPA, to shows the SPA routes from there, like <code>www.example.com/en/route1/route2/spa/spaRoute1</code> using the history mode of Vue-Router.</p>
  
  <p>I have tried modify the <code>.htacces</code> like the documentation of vue-router shows but it doesnt help.</p>
  
  <p><a href="https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations" rel="nofollow noreferrer">https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations</a></p>
  
  <p>I have the router in history mode like this:</p>
  
  <pre><code>export default new Router({
      mode: 'history',
     etc....
  })
  
  </code></pre>
  
  <p>and my .htaccess  using the configuration of vue-router docs </p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  </code></pre>