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?
2
Answers
Insert that in .htaccess file
!!!!! 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