Apache docker container - Invalid command 'RewriteEngine' Apache docker container - Invalid command 'RewriteEngine' apache apache

Apache docker container - Invalid command 'RewriteEngine'


This works for me:

# DockerfileFROM php:5.6-apacheMAINTAINER Raphael Mäder <me@randm.ch>RUN a2enmod rewriteADD . /var/www/html

Don't forget to run your docker-compose up command with --build if you have already built the image previously, otherwise it will run the old image which may have not included the RUN a2enmod rewrite statement.


Add this to your Dockerfile:

# Enable mod_rewrite for images with apacheRUN if command -v a2enmod >/dev/null 2>&1; then \        a2enmod rewrite headers \    ;fi