[Vuejs]-Problem with configuring virtual host for single page vuejs app

0👍

I changed my code like below and it worked!

<VirtualHost *:80>
ServerAdmin example@email.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/dist

<Directory /var/www/example.com/dist/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

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

</Directory>

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

<IfModule mod_dir.c>
    DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>

I put the following code inside the <Directory /var/www/example.com/dist/> </Directory> part and it is working fine.

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

Leave a comment