[Resolved] htaccess ExpiresByType ignored

Status
Not open for further replies.

anything

Well-Known Member
#1
Hi.

I have a problem where if ExpiresByType is defined in apache config, then .htaccess ExpiresByType is ignored.

/etc/httpd/conf/httpd.conf:
Code:
ExpiresActive On
ExpiresByType image/* A604800
/var/www/default/.htaccess:
Code:
ExpiresActive On
ExpiresByType image/* A31536000
On litespeed we see
Code:
Cache-Control: public, max-age=604800
On apache we see
Code:
Cache-Control: public, max-age=31536000

If I remove ExpiresByType from httpd.conf, .htaccess successfully sets the expire time.
/etc/httpd/conf/httpd.conf:
Code:
#ExpiresActive On
#ExpiresByType image/* A604800
/var/www/default/.htaccess:
Code:
ExpiresActive On
ExpiresByType image/* A31536000
On litespeed we see
Code:
Cache-Control: public, max-age=31536000
On apache we see
Code:
Cache-Control: public, max-age=31536000
I even tried disabling expires completely:
/etc/httpd/conf/httpd.conf:
Code:
ExpiresActive On
ExpiresByType image/* A604800
/var/www/default/.htaccess:
Code:
ExpiresActive Off
On litespeed we see
Code:
Cache-Control: public, max-age=604800
On apache we see (no cache-control header at all)


I tested this on litespeed 5.0.8 64bit and and older litespeed 4.2.23 64bit, both do the same.

My litespeed config also has Enable Expires: Yes in the webserver config manager. Changing any of these settings didn't make any difference (as expected).
 
Last edited by a moderator:

NiteWave

Administrator
#2
my tests shows litespeed 5.0.8 behave same as apache.

https://httpd.apache.org/docs/2.2/mod/mod_expires.html
Description: Enables generation of Expires headers
Syntax: ExpiresActive On|Off
Context: server config, virtual host, directory, .htaccess
Override: Indexes
please check AllowOverride directive in httpd.conf, if see "AllowOverride None", try to change to "AllowOverride All", see if any difference.
also, check if "RewriteEngine On" exist in .htaccess or not.
 
Last edited by a moderator:

anything

Well-Known Member
#3
apologies, ive gone back to my test server and I cannot replicate the problem.
nothing has changed since yesterday, so I'll blame a bad batch of coffee instead.
 
Status
Not open for further replies.
Top