How to optimize Joomla for performance
This article describes specific steps you can take to optimize a Joomla site.
Optimizing Joomla
Joomla includes several configuration options that you can use to help improve your site's speed and responsiveness. The procedures below show how to configure these options so they are optimized for high performance.
The settings described in this article are for Joomla 3.4. Earlier Joomla versions may not include some of these settings.
If you configure the settings as described below and your site's performance is still not at the level you want, there are additional options:
Caching
Joomla includes a built-in caching feature, but it is disabled by default. To enable caching for your site, follow these steps:
- Log in to Joomla as the administrator.
- On the top menu bar, click System, and then click Global Configuration.
- Click the System tab.
- Under Cache Settings, in the Cache list box, select ON - Conservative caching.
With conservative caching, all site visitors see the same cached content (this is how caching works on most sites). With progressive caching, the site caches content for each unique visitor. This is a resource-intensive process and can negatively affect site performance. For performance reasons, you should only use conservative caching (or no caching at all).
- In the Cache Time text box, type the maximum length of time (in minutes) that Joomla should store files in the cache until they are refreshed.
If your site content does not change frequently, you can set the cache time to a longer interval. Similarly, if your site content updates frequently, you should set a shorter cache time interval.
- Click Save.
- On the top menu bar, click Extensions, and then click Plugin Manager.
- In the Search box, type cache and then press Enter.
- In the Status column for System - Page Cache, click the red X icon to enable the plugin. Caching is now enabled for Joomla.
Apache optimizations
You can add some Apache directives to the .htaccess file in Joomla's root directory that help decrease page load times for your site.
Compression
The Apache mod_deflate module enables you to compress output. This both saves bandwidth and ensures faster page download times. To enable output compression for Joomla, follow these steps:
- Open the .htaccess file in your preferred text editor.
If the .htaccess file does not exist in the Joomla directory, create it.
- Add the following lines to the .htaccess file:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript
</IfModule>
- Save your changes to the .htaccess file. The changes take effect immediately.
Browser caching
The Apache mod_expires module enables you to instruct web browsers how long to cache certain types of content. This both saves bandwidth and ensures faster page download times. To enable browser caching directives for Joomla, follow these steps:
- Open the .htaccess file in your preferred text editor.
If the .htaccess file does not exist in the Joomla directory, create it.
- Add the following lines to the .htaccess file:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresDefault "access plus 1 week"
</IfModule>
- Save your changes to the .htaccess file. The changes take effect immediately.
JavaScript and CSS files
You can help reduce your site's page load times by optimizing JavaScript and CSS files. This process includes:
- Combining JavaScript and CSS files. This reduces the number of HTTP requests required to load a page.
- Minifying JavaScript and CSS files. This reduces the amount of bandwidth required to load a page.
There are several Joomla plugins that enable you to do these optimizations; the JCH Optimize plugin is one of the most popular. To install this plugin, follow these steps:
- Download to your computer the JCH Optimize installation .zip file located at https://www.jch-optimize.net/downloads.html.
- Log in to your Joomla site as the administrator.
- On the Administration page, on the top menu bar, click Extensions, and then click Extension Manager.
- Under Upload Package File, click Browse.
- Locate the plg_jch_optimize_4.2.1.zip file, and then click Open.
The exact filename varies based on the version you download.
- Click Upload & Install. Joomla installs the extension.
- On the top menu bar, click Extensions, and then click Plugin Manager.
- In the Search box, type jch and then press Enter.
- In the Status column for System - JCH Optimize, click the red X icon to enable the plugin. The icon changes to a green checkmark when the plugin is enabled.
- Select the check box for System - JCH Optimize, and then click Edit. The JCH Optimize configuration page appears.
- Under Automatic settings, click Minimum.
- Click Save & Close.
Developer debugging
Joomla includes two options to help developers debug and troubleshoot problems. These options can consume system resources and negatively affect performance, so they are disabled by default.
You should only enable these options if you need to troubleshoot a specific problem. To verify that these options are disabled for your site, follow these steps:
- Log in to Joomla as the administrator.
- On the top menu bar, click System, and then click Global Configuration.
- Click the System tab.
- Under Debug Settings, confirm that the Debug System and Debug Language options are set to No.