Powered Cache relies on the file-optimizer.php file, found in the plugin’s ‘includes’ directory, for optimizing CSS and JS files. Modifying the file optimizer offers several benefits:

  • Enhances CDN Compatibility: Some CDN services may bypass requests when they detect a “.php” in the resource URL. Rewriting the file optimizer resolves this issue.
  • Addresses WAF Rules: If you have set up Web Application Firewall (WAF) rules that prevent file-optimizer.php from executing, using a rewrite can circumvent this limitation.
  • Improved Resource Naming: Utilizing rewrite rules allows for more intuitive and organized naming of related resources.

Example URL Without rewrite:


Example URL With rewrite:


If your server is compatible with .htaccess and you’ve enabled automatic .htaccess configuration, simply activating this feature is all you need to do. However, if you’d rather handle rewrite rules manually, you can apply the following code snippets:


<IfModule mod_rewrite.c>
  # Enable rewrite engine
  RewriteEngine On
  # Redirect all requests starting with /_static/
  RewriteRule ^_static/.* wp-content/plugins/powered-cache/includes/file-optimizer.php [L]


location /_static/ {
        fastcgi_pass unix:/var/run/fastcgi.sock;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/wp-content/plugins/powered-cache/includes/file-optimizer.php;

If you are using runcloud for server management, then add this as a custom nginx rule with choosing “location.main-before” for the location

location /_static/ {
        fastcgi_pass unix:/var/run/{APP_NAME}.sock;
        include /etc/nginx-rc/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME  $document_root/wp-content/plugins/powered-cache/includes/file-optimizer.php;