title: Apache docker container - Invalid command 'RewriteEngine'
body: <p>I use docker compose. However, when I run "docker-compose up", I came across an error : /var/www/html/.htaccess: Invalid command 'RewriteEngine'.</p>
  
  <p>Can you tell me where I fails ??</p>
  
  <p>Project architecture :</p>
  
  <pre><code>project-name /
               / docker-compose.yml
               / Dockerfile
               / apache.conf
               / php.ini
               / src /
                     / index.php
                     / .htaccess
  </code></pre>
  
  <p>docker-compose.yml :</p>
  
  <pre><code>web:
      build: .
      ports:
          - "80:80"
      volumes:
          - ./src:/var/www/html
          - php.ini:/usr/local/etc/php/conf.d/30-custom.ini
          - apache.conf:/etc/apache2/sites-enabled
      environment:
          - ALLOW_OVERRIDE=true
  </code></pre>
  
  <p>Dockerfile :</p>
  
  <pre><code>FROM php:7.0-apache
  
  RUN a2enmod rewrite
  
  RUN service apache2 restart
  
  ADD ./src /var/www/html
  </code></pre>
  
  <p>php.ini :</p>
  
  <pre><code>display_errors=1
  error_reporting=E_ALL
  </code></pre>
  
  <p>apache.conf (with my ip address) :</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName xxx.xxx.xx.xxx
      DocumentRoot /var/www/html
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I type in the command line : </p>
  
  <pre><code>docker@default:/blabla/project-name$ docker-compose up
  </code></pre>
  
  <p>it returns me :</p>
  
  <pre><code>AH00558: apache2: Could not reliably determine the server's fully 
  qualified domain name, using xxx.xx.x.x. Set the 'ServerName' directive 
  globally to suppress this message
  </code></pre>
  
  <p>and</p>
  
  <pre><code>/var/www/html/.htaccess: Invalid command 'RewriteEngine', 
  perhaps misspelled or defined by a module not included in the server
  configuration
  </code></pre>
  
  <p>and in the browser, in my ip address (<a href="http://xxx.xxx.xx.xxx/" rel="noreferrer">http://xxx.xxx.xx.xxx/</a>) :</p>
  
  <pre><code>500 Internal servor error
  </code></pre>
  
  <p>my .htaccess :</p>
  
  <pre><code>&lt;files .htaccess&gt;
      Require all denied
  &lt;/files&gt;
  Options +FollowSymlinks -Indexes -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)/$   /$1 [L,R=301]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
  </code></pre>
  
  <p>I'm on windows and i use Oracle VM Virtual Box.</p>
  
  <p>Thank you in advance !</p>
  
  <p>EDIT : I should say that if I delete rewrite rules, everything works.</p>