How to speed up your WordPress Website: Tips And Tricks

A slow WordPress website costs you both users and search rankings — the fix is a targeted set of speed optimisations covering caching, image compression, hosting, and plugin cleanup rather than one single setting. Applying even three or four of these consistently produces a noticeably faster site within a day, based on changes I’ve tested directly on live builds.

Why Speed Matters More Than It Seems

A fast WordPress website isn’t just a nice-to-have — it directly shapes whether visitors stay or bounce, and whether search engines rank your pages favourably. Every extra second of load time increases the chance a visitor leaves before your content even renders, and slow pages tend to get deprioritized in search results over time.

Most website owners, especially those just starting out, don’t realise how many small technical choices compound into a sluggish site: bloated themes, unoptimized images, too many active plugins, and mediocre hosting all stack on top of each other. The tricks below aren’t theoretical — they’re the specific changes I’ve applied and tested on real WordPress sites to bring load times down in a measurable way.

So I will recommend you take some important steps before you go further. If you are a beginner, you must read the Prerequisites section to avoid making problems and/or crashing your WordPress website.

Prerequisites

  1. Create a backup of the .htaccess file. (You can reload it if the changes break your website)
  2. Purge all caches and disable the caching plugin.
  3. Check your website by refreshing it to ensure it’s still working.
  4. If you find that your website is not loading or not working, find a possible solution for that error.

How to increase WordPress website Speed using the .htaccess file

First, we will take a brief overview of a list of .htaccess file tricks to enhance and increase speed. This list covers the major and recommended changes recommended by most developers to increase website speed.

  • Compression (Gzip and Deflect)
  • Disable Image Hotlinking
  • Activate mod_pagespeed option
  • Enable light speed server cache

Enable GZIP compression

Compressing files on your local computer can save a lot of disk space. Similarly, for the web, we can use GZIP compression. This will dramatically reduce bandwidth usage and the time it takes to access your website. GZIP compresses various files so that whenever a visitor tries to access your website, their browser will first have to unzip the website. This process reduces bandwidth usage considerably.

You can use either a plugin like PageSpeed Ninja to enable GZIP compression, or add the following code to your .htaccess file.

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

Disable Image Hotlinking

This trick restricts other sources from using your website images. There is a huge chance that spammers can use your image link on their own website. Every time someone visits their page, the linked images will be loaded from your website/server. This is called image Hotlinking.

So you copy and paste the code below into your .htaccess file to prevent image Hotlinking.

# DISABLE IMAGE HOTLINKING START 

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?sample.com [NC] 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] 
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L] # 

#DISABLE IMAGE HOTLINKING END

Active mod_pagespeed

This trick enhances and optimizes your website, especially for relevant content, and works with the Apache Server. Google developed the Mod_pagespeed module, and now a few major hosting providers like DreamHost, SiteGround, and GoDaddy use it to increase their page speed. However, you can install this module using SSH on your cPanel.

Copy and paste the code below into the .htaccess file to enable this module.

# ENABLE MOD PAGESPEED START # COMBINE CSS, COMPRESS IMAGES, REMOVE 
#HTML WHITE SPACE AND COMMENTS 

<IfModule pagespeed_module> 
ModPagespeed on 
ModPagespeedEnableFilters rewrite_css,combine_css 
ModPagespeedEnableFilters recompress_images 
ModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webp 
ModPagespeedEnableFilters collapse_whitespace,remove_comments 
</IfModule>

#End

LightSpeed Cache

Suppose you are using a LightSpeed server to run your website. Use the code below to enable the LightSpeed Cache Option.

# ENABLE LITESPEED CACHE START 

<IfModule LiteSpeed> 
CacheEnable public 
RewriteEngine On 
RewriteCond %{REQUEST_METHOD} ^GET|HEAD$ 
RewriteCond %{HTTP_HOST} ^sample.com|sample.net|sample.org [NC] 
RewriteCond %{REQUEST_URI} !login|admin|register|post|cron 
RewriteCond %{QUERY_STRING} !nocache 
RewriteRule .* - [E=Cache-Control:max-age=300] 
</IfModule> 

#ENABLE LITESPEED CACHE ENDerver level caching.

Important Note: You should add/edit the mentioned module codes one by one in your website .htaccess file. Check your website every time you add/edit a module, so it will help you to know which module is not fit for your website.

Bonus tips and tricks

Reduce image sizes

Images are the major contributors to the size increment of a given webpage. The trick is to reduce the size of the images without compromising on the quality.

If you manually optimize the images using Chrome PageSpeed Insights extension or Photoshop or any other tools, the process will take a long time. Fortunately, there are plugins available for just about everything you can think of, including image optimization. The ones worth mentioning are:

Using any of the above-mentioned plugins on your WordPress site will drastically reduce image sizes, thus improving your website’s speed.

Use advanced caching mechanisms with a caching plugin.

WordPress caching plugins (e.g., W3 Total Cache) have been around for a long time, making it easier to add caching rules to your website elements. Combining such plug-ins with advanced caching mechanisms like Varnish could help you better your website’s loading speed and ultimately speed up WordPress considerably.

Use a CDN

The people who visit your website belong to various locations globally, and needless to say, the site-loading speed will differ if the visitors are located far away from where your site is hosted. Many CDNs (Content Delivery Networks) help keep the site-loading speed to a minimum for visitors from various countries. A CDN keeps a copy of your website in various data centres located in different places. The primary function is to serve the webpage to a visitor from the nearest possible location. Cloudflare and MaxCDN are among the most popular CDN services.

Clean up WordPress database

Deleting unwanted data from your database will keep its size to a minimum and reduce the size of your backups. It is also necessary to delete spam comments, fake users, old drafts of your content, and maybe even unwanted plugins and themes. All of this will reduce the size of your databases and web files and thus speed up WordPress.

Minimize external JavaScript

Using external scripts on your web pages adds a big chunk of data to your total loading time. Thus, it is best to use as few scripts as possible, including only the essentials such as tracking tools (like Google Analytics) or commenting systems (like Disqus).

Check out: Top 9 WordPress Tips That Are Worth Knowing

Most Popular

More From Same Category