Litespeed cache + wordpress weird problem

#1
Hello all,

We're evaluating lightspeed and installed it on our cpanel server.

We've successfully install Litespeed and the cache is work for every pages except for root/main folder at www.xxx.com/, Checked on IP based website and it is working fine, only happen when we go to www.xxx.com/, It is listing files and folder instead of displaying website, below is our .htaccess and cache config.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule (.*) - [E=Cache-Control:max-age=60]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Storage Path /dev/shm/lsdiskcache

Enable Cache No
Max Object Size 128000
Cache Expire Time (seconds) 120
Cache Stale Age (seconds) Not Set
Cache Request with Query String Yes
Cache Request with Cookie Yes
Cache Response with Cookie Yes
Ignore Request Cache-Control Yes
Ignore Response Cache-Control Yes
Enable Private Cache No
Private Cache Expire Time (seconds) 120

Do-Not-Cache URL
/wp-admin/

Do-Not-Cache Domains
Not Set

Wondering if anyone can help, Thanks in advance!
 

Attachments

mistwang

LiteSpeed Staff
#2
looks like "DirectoryIndex" configuration was not applied.
Clear the /dev/shm/lsdiskcache , see if it is due to staled cache copy or not?
 
#3
Thank you for the reply, I got it fixed by changing auto index to "yes".

However, I ran into another problem, when I'm logged into wordpress and be the first person to cache load the website when the cache is on, the top bar (logged in user) is always there, even when a new visitor browse the site, he can see the bar and my login username. How can it be fixed?

I've tried to turn off "Cache Request with Query String" "Cache Request with Cookie" "Cache Response with Cookie" at litespeed server control panel, but makes no difference.

Our website is mostly static, we use wordpress as CMS and only updating content inside, while user doesn't need to login.

The admin area that we've added to Do Not Cache URL, seems not working aswell, when we're logged in, we cannot post or update anything inside, pressed update but everything stays the same, it good when we turned the cache off, already tried to delete our cache folder several times, still the same.

"Do-Not-Cache URL" "
/wp-admin
/wp-login.php
/wp-cron.php


Updated .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# BEING CACHE
RewriteRule (.*) - [E=Cache-Control:max-age=43200]
RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
# END CACHE
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
 

Attachments

Last edited:

NiteWave

Administrator
#4
RewriteRule (.*) - [E=Cache-Control:max-age=43200]
RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
should be
RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
RewriteRule (.*) - [E=Cache-Control:max-age=43200]

>I've tried to turn off "Cache Request with Query String" "Cache Request with Cookie" "Cache Response with Cookie" at litespeed server control panel
please do not change these cache policy settings

>The admin area that we've added to Do Not Cache URL
this should work, try again after update above rewrite rules

>However, I ran into another problem, when I'm logged into wordpress and be the first person to cache load the website when the cache is on, the top bar (logged in user) is always there, even when a new visitor browse the site, he can see the bar and my login username. How can it be fixed?
this looks to be a problem -- since lsws has no way if a request is from a logged in user or guest user.
in vBulletin's case, after a user logged in, it'll add some cookies like "bbimloggedin", "bbuserid" "bbpassword"(please refer http://blog.litespeedtech.com/2011/01/28/speed-up-vbulletin-sites-through-litespeed-built-in-cache/) to tell lsws to distinguish logged in users and guest users, and only cache guest user's response body. this can be fixed by adding a wordpress plugin, but so far it's not existing yet AFAIK. this is an issue but since /wp-admin is not cached, guest users can't see the backend's pages.
 
#5
Thank you so much again for the reply, it is finally working after modifying the .htaccess code.

I'm hiding the bar for the time being.

Got another problem with litespeed, https on my website seems not displaying normal website, it is showing images and text but the design is all wrong, looked at the html source the same for http and https, it just doesn't display content correct.

The browser also got an warning saying the connection is encrypted, but some of the content is inside the page is not secure (ie, images not from https.)

The server is Cpanel/WHM, when I used the script to move over, everything was automated and the site is working completely fine before moving over, I've also tried to go back to apache and both http and https are displaying correctly, so I'm not sure what is wrong.

Thanks again for the help!
 

NiteWave

Administrator
#6
not sure if it's because of cache.

try disable cache for https, see if both works fine.

to do this, in rewrite rule, add
RewriteCond %{HTTPS} !on

i.e.,
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
RewriteRule (.*) - [E=Cache-Control:max-age=43200]
 
Top