500 Errors After Upgrade
If when updating your server it starts giving you 500 errors on all your sites and writing “RewriteCond not allowed here” then take a look at these items to fix it.
Firstly, do a quick test by renaming (or deleting) your .htaccess file. If your index page reappears, keep going.
Secondly, Apache would like .conf files instead of .com’s in your /etc/apache2/sites-available directory. So go ahead and rename those files and open them up to inspect the <Directory> settings:
/etc/apache2/sites-available: mv mycoolsite.com mycoolsite.conf /etc/apache2/sites-available: vim mycoolsite.conf
Inside each config file you will need the following Allow Override (two r’s) for your site’s directory:
<Directory /var/www/> AllowOverride All </Directory>
If you do not specify All it will default to none.
Now switch dirs and remove the symlinks in sites-enabled, disable and enable your sites:
/etc/apache2/sites-available: cd ../sites-enabled /etc/apache2/sites-enabled: rm mycoolsite.com /etc/apache2/sites-enabled: sudo a2dissite mycoolsite.com /etc/apache2/sites-enabled: sudo a2ensite mycoolsite.conf
Aaaaand restart Apache
/etc/apache2/sites-enabled: sudo service apache2 restart
Revisit your sites now and your 500 errors should have disappeared, and no more errors logged complaining of rewrite directives in .htaccess.