Error 404 reloading a page of a PWA

I’ve done a PWA with Ionic4.
It is installed behind an Apache server.
It seems to work, that is I can navigate through the pages of the site, but if I reload a page than a 404 error appears.
For example, if I navigate to the page

it works well, but if I reload the page with F5, for example, then I have the error:

Not Found
The requested URL /login was not found on this server.

What could be the error?
A misconfiguration of Apache?

Thank you very much


I’ve solved fixing the Virtual Host definition on Apache in this way:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/plutoadmin
    <Directory /var/www/plutoadmin>
       	allow from all
	Options +Indexes
	Options Indexes FollowSymLinks

	RewriteEngine on
	# Don't rewrite files or directories
	RewriteCond %{REQUEST_FILENAME} -f [OR]  
	RewriteCond %{REQUEST_FILENAME} -d  
	RewriteRule ^ - [L]
	# Rewrite everything else to index.html to allow html5 state links
	RewriteRule ^ index.html [L]  


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

1 Like