Joker! 😉
Please undo the last changes in the .htaccess if you are still using it and use this code instead and try again.
RewriteCond %{REQUEST_URI} ^\/$
RewriteRule .* - [E=esi_on:1]
IMPORTANT! Please purge browser cache!
Thread Starter
hagenb
(@hagenb)
Please undo the last changes in the .htaccess if you are still using it and use this code instead and try again.
I replaced it like you said
IMPORTANT! Please purge browser cache!
I did. I cleared all cache, including my browser.
But unfortunately it didn’t work 🙁 I still have exactly the same issue as before.
In any case, it was worth a try, but the last code change worked?
Thread Starter
hagenb
(@hagenb)
Yes, but I changed it a bit, what I’m currently using that is working is:
<FilesMatch "\.(php|PHP)$">
Header set Cache-Control "private,max-age=0,no-cache,no-store,must-revalidate"
</FilesMatch>
That changes nothing, because WP has no .htm or .html file extensions. But we could try something else. But I still have to test that. Just in case you want to leave no stone unturned?
Thread Starter
hagenb
(@hagenb)
But we could try something else. But I still have to test that. Just in case you want to leave no stone unturned?
I’m willing to try anything you might think will work.
Okay, maybe in the afternoon I can do it.
Here comes the last try, really the last try. 🙂
Before you add the new code, remove the previous one. Purge your browser cache and remove all cookies. Then navigate to your site and request the startpage frequently, but don’t reload it.
Add this code on top of your .htaccess:
RewriteCond %{REQUEST_URI} ^\/$ [NC]
RewriteRule ^.*$ - [ENV=CACHECONTROL:true]
Header set Cache-Control "max-age=0,private,no-cache,no-store,must-revalidate" env=CACHECONTROL
I have tested it and it works (for me).
Thread Starter
hagenb
(@hagenb)
It unfortunately did not work 🙁
Have you tried this on your test site?
I have just tried it and it works.
Thread Starter
hagenb
(@hagenb)
I did test it, but it didn’t work so I changed it back.
I’m actually happy with how it is running now. With this in my .htaccess:
<FilesMatch "\.(php|PHP)$">
Header set Cache-Control "private,max-age=0,no-cache,no-store,must-revalidate"
</FilesMatch>
I tested the above by clearing browser cache, then I visit my site. All the pages I visit for the first time (logged out) don’t get cached x-litespeed-cache: miss. When I visit the same page again (still logged out) it returns cached pages x-litespeed-cache: hit. Then I log in and the menu gets updated as it should and the user still gets cached pages x-litespeed-cache: hit, unless I have not visited a page before logging in.
Corect me if I’m wrong, but is this how it should be?
You are a bit wrong. 😉 The cache status doesn’t matter in this case. It ‘s only about the status code and this must be 200 instead of 304 if the code works.
I would like to test it myself, but with the last code?