jtmarmon
jtmarmon

Reputation: 6179

Apache docker container - .htaccess rewrite rule 404

I have a rewrite rule in my .htaccess like so: RewriteRule ^ /var/www/index.html [L] (for an angular app's view routing)

However, when I go to /anything I get 404. Any idea why this would be? Base docker container is eboraas/apache.

My dockerfile:

FROM eboraas/apache

RUN a2enmod rewrite

ADD . /var/www

EXPOSE 80

Edit: also tried rule ^.*$ with no luck. it appears to be that .htaccess is not being used/is being ignored, not that the rule is wrongly configured.

Upvotes: 5

Views: 10306

Answers (1)

Dmytro
Dmytro

Reputation: 5701

In my case AllowOverride All was already in place for the whole /var/www directory, I just only had to add this into Dockerfile:

# enabling mod_rewrite
RUN cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/

Upvotes: 4

Related Questions