title: .htaccess for apache 2.2 doesn't work on apache 2.4 vagrant development box
body: <p>The .htaccess file below works fine for various hosted websites, all on apache 2.2, but the test environment and new websites on cloud servers are running on apache 2.4.</p>
  
  <p>The problem is that access to a php file no longer works unless the full filename including .php is added e.g. <code>www.example.com/about.php</code> rather than <code>www.example.com/about</code></p>
  
  <p>Any help with the below much appreciated - ideally with a .htaccess that works with both 2.2 and 2.4 apache. </p>
  
  <pre><code>Options -Indexes +multiviews
  RewriteEngine On
  RewriteBase /
  
  ErrorDocument 404 /404.php
  #ErrorDocument 500 /500.php
  
  # Add www.
  RewriteCond %{HTTP_HOST} !^www\.
  #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  
  # Remove .php
  #RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
  #RewriteRule (.*)\.php$ $1 [R=301]
  
  # remove index
  RewriteRule (.*)/index$ $1/ [R=301]
  
  # remove slash if not directory
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*)/ $1 [R=301]
  
  # add .php to access file, but don't redirect
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteCond %{REQUEST_URI} !/$
  RewriteRule (.*) $1\.php [L]
  </code></pre>
  
  <p>---edit---</p>
  
  <p>Below is the apache 2.4 000-default.conf which is used for the VirtualHost</p>
  
  <pre><code>php_value auto_prepend_file /vagrant/www/fixdocroot.php
  
  &lt;VirtualHost *:80&gt;
     ServerName dev.dev
     ServerAlias *.dev
     UseCanonicalName Off
  
     VirtualDocumentRoot "/vagrant/www/%-2+/public_html"
  
     &lt;Directory /vagrant/www&gt;
         AllowOverride All
         Require all granted
     &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>---further edit ---
  Apache error log is as follows:</p>
  
  <pre><code>[Mon Jan 11 09:26:35.751982 2016] [core:notice] [pid 1812] AH00094: Command line: '/usr/sbin/apache2'
  [Mon Jan 11 09:44:22.816423 2016] [:error] [pid 1892] [client 192.168.33.1:49762] PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0, referer: http://speechlink-primary.dev/infant/assessment/start/15
  [client 192.168.33.1:49804] AH00687: Negotiation: discovered file(s) matching request: /vagrant/www/domainname/public_html/page-name (None could be negotiated).
  </code></pre>