简体   繁体   English

Apache docker容器 - .htaccess重写规则404

[英]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) 我在.htaccess中有一个重写规则,如下所示: RewriteRule ^ /var/www/index.html [L] (对于角度应用程序的视图路由)

However, when I go to /anything I get 404. Any idea why this would be? 然而,当我去/任何我得到404.任何想法为什么会这样? Base docker container is eboraas/apache . 基座码头集装箱是eboraas / apache

My dockerfile: 我的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. 它似乎是.htaccess没有被使用/被忽略,而不是规则被错误配置。

In my case AllowOverride All was already in place for the whole /var/www directory, I just only had to add this into Dockerfile : 在我的情况下, AllowOverride All已经存在于整个/var/www目录中,我只需要将它添加到Dockerfile

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM