I deploy application developed by Angular to Apache Web server in Docker container. Since it is SPA I need to redirect all requests with different routes to index.html.
I try to solve it.
- I change
apache2.conf
file
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
- I add
.htaccess
file to the folder whereindex.html
is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) index.html [NC,L]
</IfModule>
- Then I reload server with command
/etc/init.d/apache2 reload
It was not helpful - I stop container and start it again. Not help
- I commit container and re-run it from new image. Not help
Can somebody explain me what's wrong and how to use .htaccess in correct way?