I found out about the Autoptimized wordpress plugin not so long ago and have been using it for all my wordpress blogs. In short, it helps in minimising and consolidating all js and css that you might have from your active theme and plugins into a single js and single css.
The plugin is working great but I had some issues while using it on a self managed cloud server (in my case, digital ocean). For some reasons, the path to the consolidated js and css wasn’t accessible and returning 404.
I was checking /var/log/apache2/error.log and found the following mentioned:
/var/www/wp-content/cache/autoptimized/.htaccess: Require not allowed here
Checking the .htacess file, I found a mention of the Require keyword
Require all granted
Next thing I check is /etc/apache2/apache2.conf. What caught my eyes was this segment and the AllowerOverride line
If you read through http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride, you will see that with the above setting, only directives controlling document types are allowed in .htaccess (due to FileInfo). In order for the Require directive to be allowed, we need to add AuthConfig, as below.
AllowOverride FileInfo AuthConfig
Save the file after edit, and don’t forget to restart Apache with:
sudo service apache2 restart
That’s it. Your css and js file will be served properly by Autoptimized now.
Please leave a comment if you find this useful or have other questios/suggestions.