I am having an issue with enabling minify with the W3TC plugin. I am using a LEMP stack and cloudfront as a CDN, and all of these features, except for the minify work fine. In order to enable fancy permaplinks in WP I added /index.php?q=$uri&$args to the try_files line in sites-available and now all of the permalinks are /index.php/postname/ which I think may have something to do with these errors.

  • Had you tried contacting plugin's developer? It's too specific setup to easily replicate and look into the issue. – Rarst May 4 '13 at 19:35
  • To fix the permalinks, you may want let WP know that Nginx supports rewrites. To do that, you may insert add_filter( 'got_rewrite', '__return_true' ); in your theme's functions.php file. Then, please make sure to update the permalinks settings. Finally, try minify in W3TC. I hope that helps. – Pothi Kalimuthu May 7 '13 at 14:34
  • @PothiKalimuthu that fixed the index.php issue but not the minify issue. Any idea what I can do for that? – Zach Russell May 7 '13 at 18:33
  • Please provide more information on what's happening when you enable minify in W3TC in order to help with your issue better. – Pothi Kalimuthu May 8 '13 at 2:26
  • I get this errpr It appears Minify URL rewriting is not working. If using apache, verify that the server configuration allows .htaccess. Or if using nginx verify all configuration files are included in the main configuration fail (and that you have reloaded / restarted nginx). and the CSS on the page breaks @PothiKalimuthu – Zach Russell May 8 '13 at 20:08

Try using the following for your rewrite rules:

location / {
     try_files $uri $uri/ /index.php$is_args$args;

Using that schema, you can manually remove index.php from your Permalinks settings without breaking anything. Nginx will now check any URI for its existence as a file on the filesystem, and then a directory on the filesystem, and if neither of those return a valid entry it hands off the entire URI to index.php to process, complete with any query strings if any are present.

For W3 Total Cache, try the following: W3 Total Cache Minify Rewrite Error with Wordpress on nginx

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.