Reduce WordPress TTFB on Hostinger with LiteSpeed Cache

by Fahim

A fresh WordPress install on Hostinger almost always crawls out of the gate with a Time to First Byte (TTFB) between 650ms and 1,200ms. That lag bleeds into everything else. As MDN’s guide to Time to First Byte points out, high server latency stalls every downstream paint event—destroying your FCP and LCP scores before the browser even parses your CSS.

Hostinger runs on OpenLiteSpeed or LiteSpeed Enterprise. That means you already have server-level page caching sitting right in front of PHP. If your TTFB on static, public pages is over 200ms, your caching layer simply isn’t doing its job. Here’s how I get it consistently down under 50ms.

Close-up terminal screen showing curl command measuring sub-50ms WordPress TTFB and LiteSpeed cache hit headers
Close-up terminal screen showing curl command measuring sub-50ms WordPress TTFB and LiteSpeed cache hit headers

Step 1: Benchmark Your Baseline TTFB with curl

Skip the browser DevTools for this. Local extensions, cached DNS lookups, and lingering keep-alive sockets skew the readings. I always use a raw curl command directly against the server to see the true connection latency and raw headers.

Open your local terminal and run this:

curl -s -w "DNS: %{time_namelookup}snConnect: %{time_connect}snTLS: %{time_appconnect}snTTFB: %{time_starttransfer}snTotal: %{time_total}sn" -o /dev/null https://yourdomain.com/

On an unoptimized Hostinger setup, you’ll likely see numbers like this:

DNS: 0.021s
Connect: 0.052s
TLS: 0.118s
TTFB: 0.847s
Total: 0.852s

An 847ms TTFB means your server spent over 700ms just spinning up PHP, talking to MySQL, and running hooks before firing off a single byte. Now check what LiteSpeed is actually doing with that request:

curl -I https://yourdomain.com/

Look at the x-litespeed-cache header. If you see miss after three refreshes, or if the header doesn’t show up at all, LiteSpeed is passing every request straight to the PHP runtime. When it works, you get a hit, and the page serves straight from memory or disk without touching WordPress core.

Step 2: Enable Server-Level Page Caching in LiteSpeed

The most common mistake I see is installing the LiteSpeed Cache (LSCache) plugin and assuming it’s working right away. The plugin doesn’t actually cache pages—it just manages rewrite rules in .htaccess and tells the LiteSpeed server daemon what to keep and what to purge.

Go to your WordPress Admin dashboard and click LiteSpeed Cache > Cache. Set these options:

  • Enable Cache: ON
  • Cache Logged-in Users: OFF (Unless you run a membership site with private cache contexts)
  • Cache Commenters: OFF
  • Cache REST API: ON
  • Cache login page: ON
  • Cache favicon.ico: ON
  • Cache PHP Resources: ON
  • Cache Mobile: OFF (Keep this OFF unless you run a completely separate mobile theme or AMP; leaving it on doubles your cache footprint)

Next, switch to the TTL tab. Hostinger’s defaults are too aggressive. Short TTLs create constant cache churn, forcing unnecessary regenerations:

  • Default Public Cache TTL: 604800 (7 days)
  • Default Front Page TTL: 604800 (7 days)
  • Default Feed TTL: 604800 (7 days)
  • Default REST TTL: 259200 (3 days)

LiteSpeed clears post and archive caches automatically whenever you publish or edit content, so a 7-day TTL won’t serve stale content to visitors. Check the official LiteSpeed Cache documentation if you need to fine-tune specific edge cases.

Step 3: Verify and Fix .htaccess Directives

If file permissions were off when you activated the plugin, LiteSpeed may fail to append its directives to .htaccess. The dashboard will show caching is “enabled,” but LiteSpeed silently ignores it.

Open .htaccess in your public_html root via SSH or the Hostinger File Manager. Make sure these markers sit at the very top of the file:

# BEGIN LSCACHE
## LITESPEED WP CACHE EXCLUSION RULES

RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule .litespeed_conf.dat - [F,L] ### marker CACHE RESOURCE start ###
RewriteRule wp-content/.*/[^/]*(responsive|css|js).php - [E=cache-control:max-age=120000]
### marker CACHE RESOURCE end ### ### marker FAVICON start ###
RewriteRule favicon.ico$ - [E=cache-control:max-age=86400]
### marker FAVICON end ### 
# END LSCACHE

If you don’t see those lines, drop them above your standard WordPress rewrite rules. If your changes don’t save, double-check your file permissions: you want 644 for .htaccess and 755 for directories.

Step 4: Offload Dynamic WP-Cron Execution

By default, WordPress checks for pending cron jobs (scheduled posts, update checks, backups) on every single page load. If an uncached visitor lands on your site when a task is due, their request gets hijacked while PHP runs the job. Your TTFB will spike past 2,000ms instantly.

To fix this, open wp-config.php and disable the default pseudo-cron right above the database block:

define('DISABLE_WP_CRON', true);

Then set up a real system-level cron inside Hostinger hPanel under Advanced > Cron Jobs. I wrote a step-by-step breakdown to replace WP-Cron with a real system cron job on Hostinger. Running it on a 15-minute schedule keeps background tasks completely detached from user traffic.

Step 5: Configure Redis Object Caching

Page caching takes care of anonymous visitors, but dynamic requests—logged-in sessions, WooCommerce carts, and search endpoints—have to hit the database. Each hit can run dozens of redundant SQL queries just pulling basic site options.

An object cache keeps those query results in RAM. If you are on Hostinger Business or Cloud plans, Redis is included. Turn on the Redis extension first under PHP Configurations > PHP Extensions in hPanel.

Then open LiteSpeed Cache > Cache > Object in WordPress and use these settings:

  • Object Cache: ON
  • Method: Redis
  • Host: 127.0.0.1
  • Port: 6379
  • Default Object Lifetime: 360
  • Persistent Connection: ON
  • Cache WP-Admin: OFF
  • Store Transients: ON

Hit save. The status banner should update to Connection Test: Passed. If you run into socket errors or permission refusals, check out our guide to configure Redis object cache in WordPress on Hostinger for alternative socket paths.

Step 6: Purge Autoloaded Options and Transients

A bloated wp_options table is a silent TTFB killer on shared hosting. Every time WordPress boots, it executes: SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'. If that single query returns 2MB or 3MB of abandoned plugin garbage, PHP wastes hundreds of milliseconds parsing strings before anything else happens.

SSH into your instance and check the size of your autoloaded data via WP-CLI:

wp db query "SELECT SUM(LENGTH(option_value)) / 1024 / 1024 AS autoload_mb FROM wp_options WHERE autoload = 'yes';"

If that returns anything over 1.0MB, you have work to do. Run this to spot the biggest culprits:

wp db query "SELECT option_name, LENGTH(option_value) AS byte_size FROM wp_options WHERE autoload = 'yes' ORDER BY byte_size DESC LIMIT 10;"

You can clear orphaned transients and leftover plugin junk by following our walkthrough on how to clean bloated autoload options in WordPress with WP-CLI. Shaving that query down brings raw PHP startup times to single digits.

Step 7: Optimize PHP OPcache in Hostinger hPanel

When a request misses the page cache, PHP compiles your scripts into bytecode before running them. OPcache holds that compiled bytecode in shared memory so PHP doesn’t re-parse dozens of files on every execution.

In hPanel, head to Advanced > PHP Configuration > PHP Options and confirm OPcache is toggled ON. Tune it to these production values:

opcache.enable = 1
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 10000
opcache.revalidate_freq = 60
opcache.validate_timestamps = 1

Setting opcache.revalidate_freq = 60 tells PHP to recheck file modifications every 60 seconds instead of probing disk on every request. That cuts disk I/O significantly, which is critical during sudden traffic spikes.

The Gotcha: How Third-Party Cookies Break Page Caching

I hit an issue on a client site where TTFB was stuck at 850ms even though LiteSpeed showed everything was green. Running curl -I kept returning x-litespeed-cache: miss, even for clean incognito requests.

The problem was an analytics script setting an unconfigured cookie immediately on load. By default, LiteSpeed ignores full-page caching whenever it sees unknown session cookies in the request header.

To see if cookies are sabotaging your cache, check the response headers:

curl -Iv https://yourdomain.com/ 2>&1 | grep -i "set-cookie"

If an errant plugin or script drops session cookies like PHPSESSID or random tracking tokens on anonymous visitors, LiteSpeed bails on the cache. Add those cookie names under LiteSpeed Cache > Cache > Excludes > Do Not Cache Cookies or stop the script from firing before consent. Once resolved, visitors get pure cached HTML.

Verify Your Results

Flush your cache first via LiteSpeed Cache > Toolbox > Purge All. Then fire two consecutive curl requests against your homepage—the first warms the cache, the second reads from it:

curl -s -w "TTFB: %{time_starttransfer}sn" -o /dev/null https://yourdomain.com/
curl -s -w "TTFB: %{time_starttransfer}sn" -o /dev/null https://yourdomain.com/

On that second hit, you should see output close to this:

TTFB: 0.038s

Check the headers one more time with curl -I https://yourdomain.com/:

HTTP/2 200
content-type: text/html; charset=UTF-8
x-litespeed-cache: hit
cache-control: max-age=604800

A TTFB under 40ms with x-litespeed-cache: hit means the server handed over the response directly from memory without spinning up WordPress at all.

Frequently Asked Questions

Why does my TTFB spike when I am logged in to WordPress?

LiteSpeed skips public page caching for logged-in users so you always see live admin bars and draft edits. To speed up logged-in sessions, focus on Redis object caching and OPcache—both reduce the PHP and MySQL overhead on dynamic hits.

Can I use Cloudflare and LiteSpeed Cache together on Hostinger?

Yes. LiteSpeed handles page caching at the Hostinger server level, while Cloudflare handles static assets (CSS, JS, media) at edge POPs. If you use Cloudflare’s “Cache Everything” rule, configure the Cloudflare API integration in LiteSpeed Cache so your edge cache purges alongside your origin.

Why does my TTFB improve in North America but remain slow in Europe?

If your Hostinger server is in the US, requests from Europe or Asia face cross-ocean transit latency before hitting the server. To fix geographic latency without moving your origin, run your site through an edge CDN like QUIC.cloud or Cloudflare.

Does minifying CSS and JS inside LiteSpeed Cache lower TTFB?

No. Minifying and combining assets can improve LCP and FCP, but they don’t affect TTFB. TTFB measures only the time required to serve that first byte of the root HTML document.

Next Steps

Now that your initial HTML delivers in under 50ms, keep an eye on your database footprint. If you’re running a dynamic store or migrated hosts recently, check our guide on how to migrate a large WordPress site to Hostinger using SSH and WP-CLI to make sure file permissions and table indexes stay in good shape.

all_in_one_marketing_tool