0

In dev version it works good. But when I make production, throw it to host via apache and trying to enter to internal pages (non-main page '/') by path or by reload page it give 404 error. It is pretty logical because we haven't static files like 'user.html' or smth like that. How to make router generate all static files?

404

suchislife
  • 4,251
  • 10
  • 47
  • 78
loremru
  • 1
  • 2

2 Answers2

0
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html

Insert that in .htaccess file

loremru
  • 1
  • 2
0

!!!!! HOT HINT FROM: Vue Router return 404 when revisit to the url

First you need to: !!!!!!!!!!!!!!!!!!!!!! sudo a2enmod rewrite !!!!!!!!!!!!!!!!!!!!!

Then, add the following block to /etc/apache2/apache2.conf:

<Directory /var/www/html/> RewriteEngine On RewriteBase / RewriteRule ^index.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]

After this, do

sudo systemctl restart apache2

El Gigante
  • 21
  • 3