Vue Router history mode not working under Apache2

Viewed 119

I'm trying to get rid of the reload problem, with routes in history mode. Following the vue docs I created a .htaccess file in the same folder my index.html is located. The path is /var/www/example.com/sever/public. I am not sure if this means it is in subfolder or if subfolder means that the app is under somthing like "example.com/something/index.html", so I tried both of the following configurations.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

and

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /server/public
  RewriteRule ^server/public/index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /sever/public/index.html [L]
</IfModule>

I also read that by default .htaccess can be disabled, so I checked the apache2.conf file and found

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

AccessFileName .htaccess

so it seems to be enabled.

example.com.conf looks like this:

<VirtualHost *: 80>
  SeverName example.com
  ServerAlias www.example.com

  ProxyRequests Off
  ProxyPreserveHost On
  ProxyVia Full
  <Proxy *>
    Require all granted
  </Proxy>

  ProxyPass / http://127.0.0.1:8082/
  ProxyPassReverse / http://127.0.0.1:8082

  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Maybe someone can point out what I'm doing wrong.

0 Answers
Related