Title: 404 errors on static files ( WPEngine )
Last modified: February 24, 2021

---

# 404 errors on static files ( WPEngine )

 *  Resolved [Viktor](https://wordpress.org/support/users/grnetfreak/)
 * (@grnetfreak)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/)
 * Hello Frank,
 * We’ve been seeing some random 404 errors on multiple static files on a site hosted
   @ WPEngine. From their end, they said they aren’t seeing anything “off”. Purging
   the cache makes it work, checking the logs, nothing specific seems to be triggering
   this. ( e.g. a new post published )
 * Running WP 5.6.2 + Autoptimize 2.8.1 and with 404 fallbacks enabled of course.
 * Any ideas?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14093857)
 * I’m assuming the static files you mention are Autoptimized CSS/ JS files? Can
   you test if the fallbacks work by taking the URL of an Autoptimized JS-file and
   changing one number/ letter in the hash (the random part of the filename), it
   should redirect to autoptimize_fallback.js?
 * frank
 *  Thread Starter [Viktor](https://wordpress.org/support/users/grnetfreak/)
 * (@grnetfreak)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14096766)
 * Static files I meant are indeed the Autoptimize generated files! The fallbacks
   aren’t working:
 * I tried checking a CSS file autoptimize_164ccbfc71db096c97870abc99e0edd8.css –
   tried changing a letter or number near the end of the string, returns 404.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14096791)
 * You’ll need to ask WPEngine to either:
    * have 404’s handled by WordPress * OR
   ensure 404’s for wp-content/cache/autoptimize/ get redirected to `/wp-content/
   autoptimize_404_handler.php`, see example nginx configuration below
 *     ```
       location ~* /wp-content/cache/autoptimize/.*\.(js|css)$ {
           try_files $uri $uri/ /wp-content/autoptimize_404_handler.php;
       }
       ```
   
 *  Thread Starter [Viktor](https://wordpress.org/support/users/grnetfreak/)
 * (@grnetfreak)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14097504)
 * Thank you for the tip! WPEngine has added the code but now testing to see the
   filename change – I get a 410 error – I’ve enabled the error logging with the
   filter you have to monitor this!
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14097680)
 * 410 is when the fallback-handler does not find the fallback-file (wp-content/
   cache/autoptimize/js/autoptimize_fallback.js), can you check if that exists?
 * additionally; 404 fallback only works when you’re serving the AO files as static
   files, this option is on by default but maybe you changed it?
 *  Thread Starter [Viktor](https://wordpress.org/support/users/grnetfreak/)
 * (@grnetfreak)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14098194)
 * The autoptimize_fallback.js does exist and it’s accessible directly, but the 
   410 still exists.
 * And yeah, I have all but the last one ( shop cart/checkout ) options enabled 
   at the Misc Options. ( I think that’s the default setup? )
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14099271)
 * no idea I’m afraid .. can you share your site’s URL?
 *  Thread Starter [Viktor](https://wordpress.org/support/users/grnetfreak/)
 * (@grnetfreak)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14103767)
 * Could I share it privately? I replicated the issue in another environment with
   same Autoptimize settings but without random 404 errors at the moment ( it was
   the same nginx rules you suggested ) – So it could be a WPEngine wide issue for
   the 404 fallback?
 * PS: I have Frank’s email from an old conversation
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14104641)
 * yes, it could be WP Engine wide; the basic issue is that normally WordPress handles
   404’s, which AO hooks into. feel free to mail me 🙂
 * frank
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14268192)
 * hey grnetfreak ; I’m not sure if I ever received your mail (maybe I did and I
   forgot)? 🙂
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14479910)
 * No feedback so I assume this got resolved? Feel free to follow up if you still
   encounter issues!
 * have a nice day!
    frank

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘404 errors on static files ( WPEngine )’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/404-errors-on-static-files-wpengine/#post-14479910)
 * Status: resolved