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?
Asked
Active
Viewed 595 times
2 Answers
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