404 errors on minified or combined CSS/JavaScript files

Under normal circumstances, you should not find 404 errors on the minified or combined files created by WP Rocket. However there are a few external factors which can affect this.

In this Article

Google cache

Google keeps its own cache of sites, at a URL like this: http://webcache.googleusercontent.com/search?q=cache:

It takes a snapshot of your site on its own schedule - their cache is not a “live” up-to-date version of your site. 

If you have enabled the Combine JavaScript files option in WP Rocket, the filename will change periodically. So at some point, the snapshot Google’s cache has will refer to the JavaScript file which no longer exists. This will result in a 404 error.

However, visitors to your live site will see the correct version. 

Since most people are almost never viewing the Google cached version, you don’t have to worry about it. 

Disabling Combine JavaScript files and enabling only Minify JavaScript files in WP Rocket would resolve the issue because minification does not change the filename. 

Semrush, Rank Math, AHREF

If you are using one of these automated SEO tools, or any other tool which reports 404 errors on your combined JavaScript file, check the following sections for possible reasons. 

Multiple cache layers

If there is another layer of caching on your site which is not synchronized with WP Rocket’s it could lead to 404 errors. 

WP Rocket is compatible with the following cache layers, just make sure to activate the relevant add-on:

Other cache layers may not be compatible. Here are some known cases, but there could be others: 

Browser caching

Check if there are conflicting browser caching rules

Incorrect domain configuration

www/non-www

WP Rocket will manage the cache for the specific version of your domain, with or without the www , as stated in your WordPress Settings → General.

For example, if your domain is listed with www, this is the version of the cache that will be purged.

If you have not set up a redirect, the non-www version will get cached but we won’t be able to purge it and if you access the incorrect version you may see old content and 404 errors. 

The solution is to:

  1. Set up the correct redirect
  2. Remove the old files

Incorrect CDN configuration

When you enter a CNAME in the CDN option, WP Rocket just rewrites your assets to whichever CNAME you entered. If this results in a 404 error, it's likely because your CDN is not configured correctly and you should check with your provider to resolve it.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.