Autoptimize concatenates all scripts and styles, minifies and compresses them, adds expires headers, and caches them. It also moves styles to the page head and scripts to the footer.

This WordPress plugin even minifies the HTML code itself, making your page extremely lightweight. Also, there are advanced options available that allow you to tailor Autoptimize to your website’s specific needs.

  1. Log into your WordPress Admin panel.
  2. Hover your mouse over “Plugins” and click “Add New.”
  3. In the “Search” box, type “Autoptimize” and click “Search Plugins.”
  4. Click “Install Now.” A prompt dialog will open and ask if you are sure you want to install the plugin. Click “OK.” After the plugin is installed, click “Activate Plugin.”
  5. Navigate to “Settings → Autoptimize.”
  6. Click on the “Show advanced settings” button.
  7. In the HTML section, enable “Optimize HTML Code” and “Keep HTML comments.”

  8. In the “Javascript Options” section, enable “Optimize JavaScript Code” and “Force JavaScript in head.” If your .js breaks to script error, you can try enabling “Add try-catch wrapping” as well.

  9. In the “CSS Options” section, enable “Optimize CSS Code.” You can also inline your CSS so pages load faster.
    NOTE: This option is great for smaller sites, but it can actually slow down sites that have a lot of traffic.

    There is also the option to exclude certain CSS code from the plugin.

    NOTE: DO NOT enable the “Generate data: URIs for images” option. This will result in a decreased number of requests when loading your website, but will force images to be served through your origin instead of your CDN.

  10. Enter your CDN URL in the “CDN Base URL” field, and click on the “Save Changes and Empty Cache” button. Use your CDN URL instead of “http://foo.bar.netdna-cdn.com.”

    NOTE: The CDN is activated upon entering the CDN blog root directory (e.g. http://cdn.example.com/). If that URL is present, it will be used for all Autoptimize-generated files (i.e. aggregated CSS and JS), including background-images in the CSS (when not using data-uri’s).

    If you want your uploaded images to be on the CDN as well, you can change the upload_url_path in your WordPress configuration (/wp-admin/options.php) to the target CDN upload directory (e.g. http://cdn.example.net/wordpress/wp-content/uploads/).

    Do take into consideration that this only works for images uploaded from that point onwards, not for images that were already uploaded.

Autoptimize is compatible with plugins like WP Super Cache and CDN Linker which provide a more developed rewrite functionality. Note that only one of these plugins should have CDN enabled due to possible rewrite issues.

​If you have any questions about using this plugin effectively, feel free to start a live chat or leave a comment below.

  • Hi Team,

    Is it necessary to install Autoptimize when we already W3 total cache installed and configured with MAXCDN as per your recommended W3 Total Cache configurations? Thanks to clarify

    • Hello,

      You don’t need Autoptimize on your web site if you already have W3 Total Cache installed and configured correctly. If you have any additional questions, feel free to reach out to us at support [at] maxcdn [dot] com.

      • Thanks for the reply. Very helpful

  • Hi Team,
    I have a small site. I installed WP super cache for him. But when I install Autoptimize and try to configure, error 500 appear. Are they not compatible???

  • Annapurna Agrawal

    Hi,
    i have activated both, w3tc and ao. But the issue i am facing is the cache size of ao plugin.
    what should i do that is clears automatically.

  • giststudents

    Pls am new to blogging. How can I locate my own blog CDN?