1. Documentation
  2. How to
  3. Speed up your website

Speed up your website

Creating a high-performing website requires strategic optimization efforts. Below, you’ll find detailed guidance on optimizing the page loading speed of your website, addressing various factors that influence performance. Following these steps will ensure your site loads swiftly and provides an excellent user experience.

1. Hosting: choose a reliable server

Selecting the right hosting provider is paramount. Consider hosting companies like SiteGround that offer modern PHP versions (8.0+) and caching layers like Varnish. Reliable hosting forms the foundation of a speedy website.

Get started with Siteground

2. Keep theme and plugins updated

Ensure your main theme and plugins, especially the KeyDesign Framework, are always up-to-date. Regular updates bring new features, improvements, bug fixes, and security enhancements. Here’s a guide on how to update the theme.

3. Remove unused plugins

Inactive plugins can slow down your website significantly. Remove any unused plugins to reduce server load and potential conflicts. Aim for a lean set of plugins, focusing only on essential functionalities.

4. Optimize images

Optimize images before uploading them to your site. Use plugins like Tiny Compress Images to compress existing and future images efficiently. Additionally, employ the Performance Lab plugin to automatically convert images to .webp format, enhancing image file sizes.

5. Enable browser caching

Implement browser caching to prompt visitors to save and reuse your website files, reducing load times. Add the following lines to your .htaccess file (located in the root folder of your server):

# Leverage Browser Caching by setting HTTP header expires
<ifModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 30 days"
</ifModule>

6. Enable Gzip compression

Enable Gzip compression to reduce file sizes, a standard practice for faster loading. Use Gzip Test to confirm if Gzip is enabled on your site.

If your server runs on Apache, add the following lines to your .htaccess file:

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

To enable compression in NGINX add the following code to your config file:

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;

6. Caching plugin

Leverage caching plugins to enhance website performance. Consider using free options like WP Super Cache or W3 Total Cache. For exceptional speed results, consider the premium option, WP Rocket, highly recommended by WordPress experts.

7. Content Delivery Network (CDN)

Implement a CDN to distribute your website’s content across servers worldwide. Cloudflare offers a free plan with essential features, ensuring optimal global accessibility. Install the WordPress plugin from here: https://wordpress.org/plugins/cloudflare/

Following these steps will significantly enhance your WordPress theme’s loading speed. Remember, each optimization effort contributes to an overall faster and smoother user experience. Happy optimizing!

Was this article helpful?