Why does LiteSpeed Cache always want me to add / replace code in the .htaccess file?

tazarbm

Elite Member
Executive VIP
Jr. VIP
Joined
Oct 28, 2020
Messages
11,663
Reaction score
14,635
Hey guys!

I'm having a problem with the LiteSpeed Cache plugin, in the sense that it always... ok, maybe not always, but quite often it asks me to add / replace the code below (the code might be different sometimes, but in this particular case it's this one) in the .htaccess file:

Code:
# BEGIN LSCACHE
## 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 \.litespeed_conf\.dat - [F,L]

### 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 FAVICON start ###
RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
### marker FAVICON end ###

### marker WEBP start ###
RewriteCond %{HTTP_ACCEPT} "image/webp"
RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]
RewriteCond %{HTTP_USER_AGENT} iPhone.*Version/(\d{2}).*Safari
RewriteCond %1 >13
RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]
### marker WEBP end ###

### marker DROPQS start ###
CacheKeyModify -qs:fbclid
CacheKeyModify -qs:gclid
CacheKeyModify -qs:utm*
CacheKeyModify -qs:_ga
### marker DROPQS end ###

</IfModule>
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END LSCACHE

Actually, more than why LSC does this I would like to know how I can stop it from pestering me with this warning many times when I log into my WP dashboard to do stuff. Can someone please tell me how I can automate this thing so that LSC can add the damn code by itself? Thanks!
 
I'm using cyberpanel with litespeed and never face such problems or editing.
You can try cyberpanel for your next project, it's one-click install anyway.

As for your problem, I don't know mate.
 
I'm using cyberpanel with litespeed and never face such problems or editing.
You can try cyberpanel for your next project, it's one-click install anyway.

As for your problem, I don't know mate.
Same. I never posted anything manually in the htaccess file.

There might be some underlying permission issues.
 
You can try cyberpanel
is this a plugin?

There might be some underlying permission issues.
this makes sense...

One question: do you use Loginizer? Because that's the only plugin that I know off the top of my head that always want me to take writing privileges off .htaccess, so these 2 plugins might conflict with each other
 
is this a plugin?

It's an alternative to cPanel. It is an open-source server management software.

The reason why loginizer asks you to remove the writing permission off htaccess file is for security reasons. It's safer when your plugins cannot write to server configuration files. So some malicious plugins cannot add something you didn't intend to.

The code of you posted seems to handle the cache expire headers which should help. seems safe enough
 
The code of you posted seems to handle the cache expire headers which should help. seems safe enough
I don't understand this sentence (English is not my main language and on top of it I'm not tech savvy, so might I kindly ask you to rephrase / explain what this means?)

Other than this, thanks for the clarification on cyberpanel :)
 
this makes sense...

One question: do you use Loginizer? Because that's the only plugin that I know off the top of my head that always want me to take writing privileges off .htaccess, so these 2 plugins might conflict with each other
I don't use Loginizer, but it could be because of that.
 
I don't understand this sentence (English is not my main language and on top of it I'm not tech savvy, so might I kindly ask you to rephrase / explain what this means?)

Other than this, thanks for the clarification on cyberpanel :)

Every static file (image, stylesheet, javascript files, and others) sent through a server has an expiration date. Browsers keep these file in temporary storage (cache) on users device and uses them if they haven't expired yet. Static files don't change often so it is a good practice to store them longer. The code with its manages when a browser should fetch new files from a server.

'cache-control:max-age=3600" means the file is stored in users device for 3600 seconds after first download

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-age
 
is this a plugin?


this makes sense...

One question: do you use Loginizer? Because that's the only plugin that I know off the top of my head that always want me to take writing privileges off .htaccess, so these 2 plugins might conflict with each other
it's like a c-panel but free made especially for LiteSpeed

Check the link below, all major VPS hosting supports one-click install. No coding knowledge required. You can host as many websites as you like. It also supports auto-back up to G-drive and lots of convenient stuff.

https://docs.litespeedtech.com/clou... provides a One-Click,get set up for hosting.
 
Every static file (image, stylesheet, javascript files, and others) sent through a server has an expiration date. Browsers keep these file in temporary storage (cache) on users device and uses them if they haven't expired yet. Static files don't change often so it is a good practice to store them longer. The code with its manages when a browser should fetch new files from a server.

'cache-control:max-age=3600" means the file is stored in users device for 3600 seconds after first download

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-age
this is even more confusing :(

All I wanted to know is how to stop LSC display that code... is this even possible or do I have to manually edit the .htaccess file each time LSC shows me that warning.

Still, thanks for taking the time to explain. You were kind and well-intended, but alas, I suck at tech so much...
 
Make sure the .htaccess file is writable and check
it could be writable if I make it so via the Loginizer's settings, but if I have to keep .htaccess writable then Loginizer becomes useless, which is why I'm asking for options
 
it could be writable if I make it so via the Loginizer's settings, but if I have to keep .htaccess writable then Loginizer becomes useless, which is why I'm asking for options
Or you can simply change your login url to abc.com/tazalogin and get rid of Loginizer. Once you change the login url you will barely see any brute force attempts.
Could be wrong but it's mostly the case.
 
Or you can simply change your login url to abc.com/tazalogin and get rid of Loginizer. Once you change the login url you will barely see any brute force attempts.
Could be wrong but it's mostly the case.
it's an idea :)
 
Back
Top