Description
One of the most important aspects of owning a website is having it rank well with search engines. After all, no one creates a site intending for it to be buried on page 20 of a Google search.
CodeDragon SmartCache was designed as a powerful performance and caching system for WordPress websites yet easy enough for the non-technical site owner to understand. Employing several “layered” capabilities such as minifying, combining, page and browser caching and CDN support, SmartCache is able to:
- Condense served resources to improve network bandwidth
- Improve user experience by reducing the time it takes to offer your site content
- Focus on the key aspects that search indexing sites like Google regard when ranking the site
After installing SmartCache it will automatically activate the most optimal settings for your site. If you would like to further customize these settings, this introduction will walk you through some of the key steps. A more detailed instruction is available in our Startup Document. Ultimately, we have built SmartCache so that getting up and running does not require making manual changes to the wp-config.php, .htaccess, or other site files.
Minifying
At the lowest level, SmartCache will minify Javascript, CSS stylesheets, fonts, and HTML content. As well, it can automatically minimizes render-blocking files, and remove query strings.
Combining
By combining files, SmartCache helps to reduce the number of requests for files from the server, thus shortening the amount of time required to load a page.
Page Caching
Page caching goes further by implementing GZip Compression, preparing a separate HTTPS cache and serving a “flattened” HTML version of your site’s pages. With GZIp Compression and static HTML content pages are provided with less processing from the server.
Browser Caching
At this point SmartCache instructs your server with the preferred expiry periods for several file types, so client browsers can comfortably reuse cached files until they expire.
SmartCache Features
- Plugin is ready to go, with the most optimal setup, after activation
- Easy to configure without using techical jargon or confusing settings
- Minify Javascript and CSS stylesheet files
- Control whether logged-in users see minified content
- Removal of query (or GET) strings from static requests
- Limit removal of only ‘ver=nnn’ query strings
- Defer loading of render-blocking Javascript script files
- Asynchronous loading of Javascript script files
- Asynchronous loading of CSS stylesheets
- Combine script and stylesheet files
- Control whether scripts and stylesheets are combined for logged-in users
- Full page caching
- Turn page caching on/off for logged-in users
- GZip compression
- Enable/disable frontpage caching
- Provide a separate cache for mobile devices
- Browser caching
- Performance test links to GTMetrix, Pingdom and Pagespeed
- Performance reports
- All this for free!
SmartCache Premium adds the following:
- Minify HTML content
- Serve static versions of HTML pages
- Include WordPress core files in minification
- Use Google(R) Closure as the minifier
- Prevent loading of jQuery Migrate
- Script and Stylesheet File Tuning. Control the minification of each file separetely
- Specify which script files to defer and/or load asynchronously
- Specify which stylesheets to load asynchronously
- Combine font requests in stylesheets
- @import expansion in stylesheets
- Select which page or pages are not to be cached
- Select which post types are not to be cached
- Clear cache when specific post types are saved
- Specify which cookies, that if set in the browser, will cause page to not be cached
- Page caching for HTTPS pages
- Select which user-agents will not receive cached files
- Control the Last-Modified Header
- Control Javascript/XML file Expiry Max Age
- Control CSS stylesheet Expiry Max Age
- Control JPEG, GIF, and PNG image file Expiry Max Age
- Control PDF file Expiry Max Age
- Control the Vary: Accept Encoding Header
- Control the Entity Tag (ETag) Header
- Amazon CloudFront CDN support
- Determine which theme files to include in CDN fileset
- Determine which minified Javascript/CSS files to include in in CDN fileset
- Specify files to exclude from the CDN fileset
- Clear revision records
- Clear transient data
- Clear auto-drafts
- Clear trashed posts
- Clear SPAM and trashed comments
- Clear OPCache and Varnish cache
- Woocommerce compatibility
- Developer friendly with hooks and filters
- Export and import plugin settings
- Customize the location of the cache folder
- Activate the plugin’s debug mode and see what is processed on each page
- Available addons
- Premium support
- Send debug info from a specific site URL with your support tickets
- Choose what post-deactivation tasks are performed: clear caches and/or delete settings
- Participate in our Premium Community forum
Screenshots
Minify files easily Control which device or browser is served cached files Finely tune the minification of each script and stylesheet file (Premium version) Scan your entire site with one call With the GTMetrix addon (Premium version), get performance reports from within your site Send support tickets using the plugin
Installation
We’ve made getting started with SmartCache simple. Once installed and activated, the optimal settings are enabled by default. There are a couple of ways to install SmartCache:
From within your site
- Go to the ‘Plugins’ menu in WordPress
- Click on ‘Add New’
- Enter ‘SmartCache’ in the search box
- Install and activate the plugin
Manually
- Download SmartCache or purchase SmartCache Premium at www.codedragon.ca
- Upload
smart-cache
to the/wp-content/plugins/
directory - Activate the plugin through the ‘Plugins’ menu in WordPress
- Go to the SmartCache admin menu to customize your setup
NGINX Notes
After activation, SmartCache will create a configuration file called ‘smartcacheopt.conf’ in the site’s document root (folder where wp-config.php is located). This file contains several optimizations to help NGINX serve your site faster. This configuration fille will need to be linked to the site’s main system file, normally found in the /etc/nginx/sites-available folder. The following command will need to be added to this system file:
include /var/www/examplesite.com/htdocs/smartcacheopt.conf;
Uninstallation
- Go to the ‘Tools’ tab in SmartCache and choose whether to clear the caches and/or delete settings when the plugin is deactivated
- Deactivate the plugin on the ‘Plugins’ page in WordPress
- Delete the plugin
- Optionally remove the optimizations between the # BEGIN SmartCache Optimization and # END SmartCache Optimization tags in the .htaccess file
- Delete the /wp-content/uploads/sc_vault and /wp-content/uploads/sc_vault_mobile folders
FAQ
-
How do I modify or delete the SmartCache rules from the .htaccess file?
- It is not recommended to alter the .htaccess file if you are not familiar with its construction. However, if you need to modify it while the plugin is active, add your rules outside the # BEGIN SmartCache Optimization and # END SmartCache Optimization tags. The rules between those tags are automatically set by the plugin.
- Once the plugin has been deactivated, you can remove the contents of the .htaccess file between the SmartCache Optimization tags.
-
Why do pages seem to load slower after I make changes to the plugin?
- Each time settings are saved, SmartCache clears the cache to make way for new files. This activity takes time to process. If you want to speed up the process of rebuilding the cached resources, select “Scan Site” from the “SmartCache” admin toolbar menu.
-
Why do pages seem to load slower after I save a post?
- If you have the “Clear Caches When Saving Post Types” option in the Tools tab set to the same post type of the post you are saving, SmartCache will clear the caches. While this option will ensure the cache is refreshed as posts are updated, SmartCache will have to rebuild the cache.
-
I don’t see the sc_vault folder in /wp-content/uploads or I don’t see any cached content within that folder.
- Depending on which settings group you have enabled, different cache folders will be created. For desktop access, the sc_vault folder will be created. The sc_vault_mobile folder is generated the first time a mobile user visits the site and the “Mobile Cache” option is set on the Browser Caching tab. Under each will be a folder for each domain of the site (the main one for standard WordPress, and one for each of the WordPress Mulitsite domains). Under these domain folders there will be one or more of the following: a sc_remote folder for any remotely acquired content, a sc_combine folder for combined files, and a sc_static folder for each statically-generated HTML file. If none of these folders appear, check the folder permissions of the /wp-content/uploads folder. A good article on setting folder permissions is [https://codex.wordpress.org/Changing_File_Permissions] https://codex.wordpress.org/Changing_File_Permissions.
-
How do I know files are being minified or combined?
-
There are two ways to check:
-
Go to any URL that is not excluded by either the “Do Not Cache Specific Pages”, “Do Not Cache Specific Post Types”, “Do Not Cache Front Page?”, or “Disable Caching Where Cookies Present?” settings. Right-click anywhere on the page and select “Inspect”. Reload the page. Click on the “Network” tab in the browser Inspector and choose either CSS or Javascript. If you see a list of files ending in “.css.php” or “.js.php” those files are minified. If you see files that look like “67507b4820af342b1252a700bc38bca4-1.css.php” those files are combined.
-
Go to the Tools tab and enable the “Enable debug mode?” option. Place the shortcode, [sc-show-debug], in any page editor content, or
echo do_shortcode(‘[sc-show-debug]’);
in a PHP theme template file (I like to add it to the footer.php file in the theme), to display SmartCache debug information to logged in administrators. This debug log will describe what the plugin is doing on the page you are viewing.
-
-
-
Why doesn’t the plugin cache files when I am logged into WordPress?
- Normally, administrative pages are not cached as these pages may contain dynamic content. If you want to view frontend pages as the public while logged in, enable the “Enable Minification for Logged-in Users?” and/or “Enable Combination for Logged-in Users?” options and select your user role from the user role list.
-
How do I serve uncached content to specific mobile devices?
- Go to the Browser Caching tab and select the mobile device(s) from the “Do Not Cache Mobile Devices” list.
-
How do I serve uncached content to specific browsers?
- Go to the Browser Caching tab and select the mobile device(s) from the “Do Not Cache User Agents” list.
-
My Woocommerce cart page is not working
- Go to the Page Caching tab and select the cart and checkout pages from the “Do Not Cache Specific Pages” list. This will disable caching on those pages.
- If your visitors are experiencing caching problems on other dynamically created Woocommerce pages, select those pages from the same list.
-
My frontpage is not displaying properly
- Go to the Page Caching tab and enable the “Do Not Cache Front Page?” setting.
-
One of my plugins are not performing properly since setting up SmartCache, or I am getting a Javascript error in the browser Inspector
- If you have installed SmartCache Premium, go to the Minify tab and go down to the Javascript File Tuning area. Start entering the subject script file name in the “Search for Files” box. When you see it appear, deselect the corresponding Minify checkbox.
-
A specific stylesheet is not displaying correctly since setting up SmartCache
- If you have installed SmartCache Premium, go to the Minify tab and go down to the Stylesheet File Tuning area. Start entering the subject stylesheet file name in the “Search for Files” box. When you see it appear, deselect the corresponding Minify checkbox.
-
I am seeing a “It looks like your .htaccess file is not writable” error
- SmartCache is trying to automatically update your site’s .htaccess file after you made some changes. If you are able locate the .htaccess file (normally in your site’s root folder — /public/domain, /var/www/domain/htdocs, etc.) and set its permissions to 666. Resave the settings. Reset the .htaccess file permissions back to 644 or 444.
-
Does the system report that is submitted with support tickets contain personal data?
- No. We only need technical information. Nothing sensitive is transmitted.
- Installation Instructions
-
We’ve made getting started with SmartCache simple. Once installed and activated, the optimal settings are enabled by default. There are a couple of ways to install SmartCache:
From within your site
- Go to the ‘Plugins’ menu in WordPress
- Click on ‘Add New’
- Enter ‘SmartCache’ in the search box
- Install and activate the plugin
Manually
- Download SmartCache or purchase SmartCache Premium at www.codedragon.ca
- Upload
smart-cache
to the/wp-content/plugins/
directory - Activate the plugin through the ‘Plugins’ menu in WordPress
- Go to the SmartCache admin menu to customize your setup
NGINX Notes
After activation, SmartCache will create a configuration file called ‘smartcacheopt.conf’ in the site’s document root (folder where wp-config.php is located). This file contains several optimizations to help NGINX serve your site faster. This configuration fille will need to be linked to the site’s main system file, normally found in the /etc/nginx/sites-available folder. The following command will need to be added to this system file:
include /var/www/examplesite.com/htdocs/smartcacheopt.conf;
Uninstallation
- Go to the ‘Tools’ tab in SmartCache and choose whether to clear the caches and/or delete settings when the plugin is deactivated
- Deactivate the plugin on the ‘Plugins’ page in WordPress
- Delete the plugin
- Optionally remove the optimizations between the # BEGIN SmartCache Optimization and # END SmartCache Optimization tags in the .htaccess file
- Delete the /wp-content/uploads/sc_vault and /wp-content/uploads/sc_vault_mobile folders
- Troubleshooting tips
-
- Check the wp-content/uploads folder to see if it is writable.
- Look in the wp-contents/uploads folder to see if there are sc_vault, sc_vault_mobile, sc_vault/http…, sc_vault/http…/sc_remote, sc_vault/http…/sc_combine, and/or sc_vault/http…/sc_static folders.
- Check the site and server error logs.
- If your site is on an Apache server check that mod_mime, mod_headers and mod_expires modules are installed. You may need to ask your server administrator if you are unsure.
- If your site is on a NGINX server, make sure the ./smartcacheopt.conf file is included in the site’s server config file (typically located in /etc/nginx/sites-available/).
Reviews
Contributors & Developers
“CodeDragon SmartCache” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “CodeDragon SmartCache” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.1.8
- Corrected the value check in the Smart_Cache_remove_update_notification() method that was preventing some 3rd-party plugins from updating properly
- Corrected the presentation order of dashboard news items
1.1.7
- Fixed
- Temporary combined file cleanup routine
1.1.6
- Fixed
- AJAX interface conflict
- Problem where combined files were being created for each unique site URL rather than distinct set of source files. This generated a large set of duplicate files, one each associated with a URL. Instead combined filenames are calculated from the hash of the filenames being combined.
1.1.5
- Fixed
- Admin Javascript error that prevents automatic scanning
1.1.4
- Changed
- Added a mechanism to run the site pre-scan upon activation
- Removed automatic Javascript deferment-by-attribute from core as it was causing some theme scripts to load improperly. Deferred placement of the scripts is still performed.
1.1.2
- Changed
- Updated the GZip Compression section in the smartcacheopt.conf generator to handle more mime types and increase the compression level
- Tested plugin for compatibility with WordPress v 4.9.6
- Minor typo corrections in admin module
1.1.0
- Initial version