Our website issue with litespeed Enable

#1
Heloo , i would like to express the stress we have had over the past 2 months. Our website is hosted with a cpanel which has lite speed, but our website script has no plugin for litespeed so for many these days, we have been testing by implementing a code via the .htaccess, which some of the codes worked showing greater improvement on speed, but everytime we were challenged by users unable to login or logout and our website hosts keep telling us, ''go out there and search for a code that fits you'' it has been real stress, luckily i for this forum where i could ask someone for help.

Our site: https://sopriza.com

is structured like this image below, where in public_html/assest we keep, images , js , js? , css, css?
and in public_html/vendor we keep installations of plugins which are extensions.

These two folders are only ones important.

Our .htaccess has mod_rewrite

Code:
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Ensure the Authorization HTTP header is available to PHP
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # Uncomment the following lines if you are not using a `public` directory
  # to prevent sensitive resources from being exposed.
  # Uncommented by Pockethold - 3rdparty flarum installer.
  RewriteRule /\.git / [F,L]
  RewriteRule ^composer\.(lock|json)$ / [F,L]
  RewriteRule ^config.php$ / [F,L]

  # Pass requests that don't refer directly to files in the filesystem to index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [QSA,L]
</IfModule>
So, when we try LS cache using

Code:
<IfModule LiteSpeed>
RewriteEngine On
CacheEnable public /
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Mobile|Opera Mini|Fennec|Windows Phone"
RewriteRule .* - [E=Cache-Control:vary=ismobile]
RewriteCond %{REQUEST_METHOD} ^HEAD|PURGE|GET$
RewriteCond %{ORG_REQ_URI} !/news
RewriteCond %{ORG_REQ_URI} !/admincp
RewriteRule .* - [E=Cache-Control:max-age=120]
</IfModule>
we dont have any folder /news
RewriteCond %{ORG_REQ_URI} !/news
RewriteCond %{ORG_REQ_URI} !/admincp

It works but users cant login. If someone, if anyone can help today, big thanks!
 
Last edited:

AndreyPopov

Well-Known Member
#2
all I know about LiteSpeed and .htaccess - LiteSpeed cache rewrite rules must be placed before any other rewrite rules with [L] flag.


P.S. are you sure that 120 seconds (2 minutes) is right choice for cache?
 
#3
Hello @AndreyPopov , thanks for the reply. I had placed the Litespeed code above all in htaccess and also had already tried 3600 as time cache, but still same problem.

If we put the litespeed code, the site improves like 3/4 almost complete, but unfortunately we have not been able.

Give me something, anything
 

AndreyPopov

Well-Known Member
#4
are you understand for what these rules?
Code:
RewriteCond %{REQUEST_METHOD} ^HEAD|PURGE|GET$
RewriteCond %{ORG_REQ_URI} !/news
RewriteCond %{ORG_REQ_URI} !/admincp
RewriteRule .* - [E=Cache-Control:max-age=120]
 
#5
i may say yes but i might miss something

this one also works, without rewitecond's , somehow similar but still login cache problem. When you remove the code, and reload.. you will see the user was logged in long ago (passed)

<IfModule LiteSpeed> RewriteEngine On
CacheDisable public /
</IfModule>
 

AndreyPopov

Well-Known Member
#6
when user logged-out it can use only public cache.

login-in user can use private or public cache depending settings and your need.


if no any differences that can see login-in and logged-out users - sets public cache on and private cache off
 
Top