Joomla optimization

Overview

Over time, you may notice that your Joomla site runs slower or doesn't run as well as it should.  This article describes some of the best potential solutions to address issues that commonly lead to slow or inefficient websites. Optimizing your site will help to speed it up and in turn attract more visitors.

Keep your site updated

Keeping your site up to date ensures it's running the most recent code to secure and optimize its performance. It's highly recommended that you keep your site updated to the most recent version. You can check if your site is up to date in your dashboard.

  1. Log into your Joomla dashboard.
  2. On the bottom left pane under 'Maintenance', you will see if an update is available.
  3. If so, click the link to begin the update.
  4. A warning about extensions displays. Any extension you use must be compatible with the new version of Joomla. Check the Extensions Directory to ensure it will continue to function after the upgrade. If so, click Install the Update.
  5. When complete, a success message displays.

Enabling caching

Caching is a software tool you can use to store your site data in a visitor's browser. This helps load your site faster since resources such as images and scripts do not have to be re-downloaded upon every page visit. They are downloaded to the visitor's browser once, then are re-used when a new page is visited. When implemented properly, caching can greatly speed up your site.

  1. Log into your Joomla dashboard.
  2. In the left pane, click Global.
  3. Click the 'System' tab at the top.
  4. Under 'Caching Settings' click the dropdown titled 'System Cache'. Choose 'ON - Conservative caching'.
  5. Scroll to the top and click 'Save & Close'.
  6. In the top menu bar, click 'Extensions'. From the dropdown select 'Plugins'.
  7. In the search bar, enter cache and click the search icon.
  8. Click the red circle icon.
  9. A success message displays notifying you that the plugin is now active.

Install extensions

Joomla offers the ability to install Extensions. These are tools you can use to add additional functionality to your site. For example, you can add extensions to help with the following:

  • Backing up your site
  • Creating contact forms
  • Calendars
  • Creating a blog

And many more. You can view Joomla extensions here:

There are also Extensions devoted to optimizing your site. For example:

From its extension page, it does the following to help optimize your website:

  • Combine javascript/css files into one
  • Combine background images in a sprite
  • Minify (Compress) and gzip aggregated files
  • Exclude individual files or files from extensions that do not aggregate well
  • Can defer javascript or place at end of page for optimized download

Check the Extensions directory for other options to optimize and cache your website.

Remove unused extensions

While extensions can help to improve your site, you should only enable extensions that your site uses. If you find you have extensions active that are not in use, make sure to disable them.

  1. In the upper toolbar click Extensions.
  2. From the dropdown, choose 'Manage > Manage'.
  3. Check the box next to the extension you wish to remove, then click the Uninstall button.

Optimize images

Images on a website are often the primary cause for a slowly loading site. Large images take time to download when your site is viewed. If you optimize your images so they are the correct size, you will notice an improvement in your site's performance. Here are some ways to optimize your images.

Do not use large images

Your original image could easily be 2MB in size. This is very large for a web page and should be resized.

Do not resize your images in HTML. This may make them appear smaller on the website, however the visitor will still download the full size of the file.

Make sure you reduce the image size before uploading it to your website. You can use a program like Photoshop to export images to a smaller size, while still retaining their quality. Using a program like this can drastically reduce the size of the image file.

Lazy Load images

Traditionally, when a website is loaded, all images load at that time. When you Lazy Load images, the images are not loaded unless they are they are viewed on the screen, meaning they load as you scroll down the page. An extension such as LLFJ allows you to implement this in your site.

Use a CDN like Cloudflare

A CDN (Content Delivery Network) copies your website data to servers around the world. This helps to speed up your site since visitors can then access servers closest to them, rather than making a connection to your server (which may be further away).

DreamHost offers Cloudflare as an option in the panel. View the following article for further details.

Adding code to your .htaccess file

An .htaccess file is a file you can add code to which changes the way visitors interact with the site. For example, you can cache specific types of pages in the visitors browser, redirect URLs, rewrite URLs, or protect files and directories. There are many things you can do with an .htaccess file which are mentioned in the following article:

The following examples are a few ways you can use this file to help optimize your Joomla website.

ETag

This line tells the browser to first look in its local cache to see if a file exists. If it does, it will load the file immediately. If not, it will download the file from the server.

FileETag MTime Size

Cache files in the visitor's browser

You can add code to cache specific file types in the visitor's browser using 'Expire headers'. For example, you can set CSS files to cache in the visitor's browser for a specific period of time. If that visitor's views your site within that time frame, the CSS files do not need to be re-downloaded because they are still stored in the visitor's browser. Doing this for multiple file types will speed up the experience for the person visiting your website.

Add the code below to the bottom of your .htaccess file to cache the most popular types of files.

# BEGIN Expire headers
ExpiresActive On

# HTML CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType text/javascript "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"
ExpiresByType text/html "now plus 1 week"
ExpiresByType application/xhtml+xml "now plus 1 week"

# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/gif "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/png "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/x-icon "now plus 1 month"
ExpiresByType image/ico "now plus 1 month"
ExpiresByType image/icon "now plus 1 month"
ExpiresByType text/ico "now plus 1 month"
ExpiresByType application/ico "now plus 1 month"
ExpiresByType image/vnd.wap.wbmp "now plus 1 month"
ExpiresByType application/vnd.wap.wbxml "now plus 1 month"
ExpiresByType application/smil "now plus 1 month"

# Audio files expiration: 1 month after request
ExpiresByType audio/basic "now plus 1 month"
ExpiresByType audio/mid "now plus 1 month"
ExpiresByType audio/midi "now plus 1 month"
ExpiresByType audio/mpeg "now plus 1 month"
ExpiresByType audio/x-aiff "now plus 1 month"
ExpiresByType audio/x-mpegurl "now plus 1 month"
ExpiresByType audio/x-pn-realaudio "now plus 1 month"
ExpiresByType audio/x-wav "now plus 1 month"

# Movie files expiration: 1 month after request
ExpiresByType application/x-shockwave-flash "now plus 1 month"
ExpiresByType x-world/x-vrml "now plus 1 month"
ExpiresByType video/x-msvideo "now plus 1 month"
ExpiresByType video/mpeg "now plus 1 month"
ExpiresByType video/mp4 "now plus 1 month"
ExpiresByType video/quicktime "now plus 1 month"
ExpiresByType video/x-la-asf "now plus 1 month"
ExpiresByType video/x-ms-asf "now plus 1 month"

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
  <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(js)$">
    Header set Cache-Control "private"
  </filesMatch>
  <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "private, must-revalidate"
  </filesMatch>
</ifModule>
# END Cache-Control Headers

Repair or Optimize your database

If you're having issues with your database, try repairing or optimizing its tables. The following article walks you through how to go about this.

Did this article answer your questions?

Article last updated PST.