Setting Expires/Cache-Control Headers seems buggy

I'm new to litespeed. I'm trying to set the expires header without success.
From my tests it seems that setting an expire header in htaccess doesn't work.
I have enabled expires setting on server level and also on virtual host, however the htaccess does not take effect and no expires header is sent.
There is any step that I should follow to make it works?
I mean, I should install mod_expires or is it built inside litespeed?
You can check on default page
that no expires is sent.

Here's my htaccess:
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
Last edited by a moderator:


virtual host level or context level
to be short, rewrite rules still support, just move them to virtual host or context (with slight grammar difference)
I have tried and it never add those headers.
If I try on basic welcome page it works, however trying to add expires header on wordpress litespeed cache does not work.
Probably it's a plugin bug. If you don't mind can you check this page: and tell me if it's sending correct headers?
Analysing it on developer console seems that js/css aren't cached....


Well-Known Member
Check "Expires Settings" in the OLS webadmin -> server configuration and in the vhost -> general.
However the problem I suppose is that I try to cache
file generated by litespeed plugin.
I wanna also notice that I'm using OpenLitespeed. Is this feature available only on enterprise version?


Staff member
In the image you shared, "Expires by type" isn't set. Are you sure that you have it set? As to your question, if the setting is available in OpenLiteSpeed, then it should be functional.
Browser cache can be enabled at the LSCache plugin level, or within the server config. If you're having difficulty at the server level, have you tried doing it from the plugin?
There's more information about both options on our wiki.
Let us know how it goes.

Jon K

Staff member
Is that for server level or virtual host level? If server level, you will also need to enable it on the virtual host level as well.
I try to clarify:
  1. I'm on OpenLitespeed
  2. I have Enabled Expires on Server level
  3. I have enable Expires on Virtual Host level and set it to cache "text/css" mime type
  4. I have correctly configured wordpress plugin, receiving x-litespeed-cache: hit
  5. I have enabled browser cache in the plugin. However if I correctly understand, this option simply add a lot of ExpiresByType to htacces, which is ignored by OpenLitespeed.
  6. I have restarted server
What I'm expecting: Expires header (not sent), Cache-Control header (not sent).
So in my opinion the generated
files can't be cached by browser. This is a bug.
If this is not supposed to work on OpenLitespeed, should be stated somewhere.
I post my configuration both server and virtual host level.
If you want I can give you access to my server and wordpress install.


I will also add my htaccess:

## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
<IfModule LiteSpeed>
RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule min/\w+\.(css|js) - [E=cache-control:no-vary]

### marker CACHE RESOURCE start ###
RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
### marker CACHE RESOURCE end ###

### marker LOGIN COOKIE start ###
RewriteRule .? - [E="Cache-Vary:wp-postpass_6f658d45f2699b4444b0184733ddbf4b"]
### marker LOGIN COOKIE end ###

### marker FAVICON start ###
RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
### marker FAVICON end ###

### marker BROWSER CACHE start ###
<FilesMatch "\.(pdf|ico|svg|xml|jpg|jpeg|png|gif|webp|ogg|mp4|webm|js|css|woff|woff2|ttf|eot)(\.gz)?$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType application/pdf A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType image/ A2592000
ExpiresByType image/svg+xml A2592000

ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/webp A2592000

ExpiresByType video/ogg A2592000
ExpiresByType audio/ogg A2592000
ExpiresByType video/mp4 A2592000
ExpiresByType video/webm A2592000

ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000

ExpiresByType application/x-font-ttf A2592000
ExpiresByType application/x-font-woff A2592000
ExpiresByType application/font-woff A2592000
ExpiresByType application/font-woff2 A2592000
ExpiresByType application/ A2592000
ExpiresByType font/ttf A2592000
ExpiresByType font/woff A2592000
ExpiresByType font/woff2 A2592000

### marker BROWSER CACHE end ###

## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Jon K

Staff member
Is it possible to get a link to the site having issues? You can PM it to me if you do not wish to post it here.
I am trying to setup properly the Litespeed on but for some reason the speed stats are extremely bad in
I have take days doing several tweaks but without any good results.

GT Metrix give me some good stats yet is suggesting to add Expires headers. are there any advance tutorial that you can point me to or suggest solution how to get Litespeed working better with the guidelines of Google Lighthouse.



Staff member
Hi @lnietob ,

Better to have a new post for new topic,.

This is really depends on the suggestions from the scoring site.
I just took a quick look, please try:
1. Image webp enable, image optimize, to reduce your site size.
2. If css/js inline won't break your site, then keep it `on`
3. If css/js combine won't break your site, then keep it `on`