0

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.

  1. I change apache2.conf file
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
  1. I add .htaccess file to the folder where index.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>
  1. Then I reload server with command /etc/init.d/apache2 reload It was not helpful
  2. I stop container and start it again. Not help
  3. 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?

0 Answers0