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.
Miraz Mac says
Thank you for the post Sir. But the problem is whenever I try to edit my .htacess file my site got a error saying “This site is not redirecting properly”. For your information I use UTF-8 encoding for my .ht access file.
Check your htaccess file, there might be other things wrong in it which isn’t covered in this post.
I’m using DigitalOcean too, albeit a different plugin. After adding that bit of config and restarting apache2, I had to reinstall the plugin too. Good to go now. Thanks!
P.S. Similar error is returned `ExpiresActive not allowed here` when you turn on the `expires` module, and adding the `Indexes` parameter to `AllowOverride` option will solve it.