Optimising your website for better performance is essential to improve user experience, reduce bounce rates, and boost search engine rankings. In this article, we will discuss advanced optimisation techniques that can help you enhance your website's performance.
1. Configure .htaccess for Expires Headers
Expires headers instruct browsers to cache specific resources for a set period, reducing server load and improving load times. To enable Expires headers, add the following code to your .htaccess file:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
2. Enable WordPress Caching
Caching can significantly improve your WordPress site's performance by storing a static version of your pages. Install a caching plugin, such as WP Super Cache or W3 Total Cache, and configure it according to your site's requirements.
Learn how to enable WordPress caching.
3. Use LiteSpeed Cache (LSCache) and Optimise Database
LSCache is a powerful caching solution for LiteSpeed Web Server. Install the LiteSpeed Cache plugin for WordPress, and enable its database optimisation features to clean up and optimise your database tables.
4. Implement a CDN
A Content Delivery Network (CDN) distributes your site's static assets across multiple servers worldwide, ensuring faster delivery based on the user's geographic location. Implementing a CDN can significantly reduce latency and improve loading speeds.
Learn how to configure Bunny.net CDN with WordPress.
5. Disable wp-cron.php
By default, WordPress uses a file called wp-cron.php to schedule tasks. However, it can cause performance issues on high-traffic sites. Disable wp-cron.php by adding the following line to your wp-config.php file:
define('DISABLE_WP_CRON', true);
Then, set up a manual cron job via your hosting control panel (cPanel) to run the script at specific intervals.
6. Enable SSL
Secure Sockets Layer (SSL) encrypts data between your website and users, improving security and boosting search engine rankings. Obtain an SSL certificate for your domain and configure your website to use HTTPS.
Learn how to enable SSL on your website.
7. Optimise PHP in cPanel
Ensure that your server is running the latest stable version of PHP, as newer versions generally offer better performance. In cPanel, navigate to "MultiPHP Manager" and select the desired PHP version for your website. Additionally, configure PHP settings (memory limit, execution time, etc.) according to your site's needs.
8. Minimise External Resources
External resources, such as fonts, scripts, and stylesheets, can increase the number of HTTP requests and slow down your site. Limit the use of external resources and consider hosting them locally to reduce load times.
9. Optimise WordPress Plugins and Themes
Choose lightweight, well-coded plugins and themes for your WordPress site. Regularly update and remove any unused or outdated plugins to prevent performance issues and security vulnerabilities.