Autoptimize: no more broken pages due to CSS/ JS not found!

When cached HTML links to deleted Autoptimized CSS/ JS the page is badly broken … no more with a new (experimental) option in AO27 to use fallback CSS/ JS which I just committed on the beta branch on GitHub.

For this purpose Autoptimize hooks into template_redirect and will redirect to fallback Autoptimized CSS/ JS if a request for autoptimized files 404’s.

For cases where 404’s are not handled by WordPress but by Apache, AO adds an ErrorDocument directive in the .htaccess-file redirecting to wp-content/autoptimize_404_handler.php. Users on NGINX or MS IIS or … might have to configure their webserver to redirect to wp-content/autoptimize_404_handler.php themselves though, but those are smart cookies anyway, no?

If you want to test, you can download Autoptimize 2.7 beta here and replace 2.6 with it.

2 thoughts on “Autoptimize: no more broken pages due to CSS/ JS not found!

  1. gwyn

    Just a note, thank you for working on this feature! It should greatly reduce the number of Google Web Tools emails about clickable elements too close together etc.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.