Disable Cache in PHP

Discussion in 'LiteSpeed Cache General' started by madesimplemedia, Mar 6, 2018.

  1. Hi,
    We develop out sites in Concrete5 CMS and I've recently got a new VPS with Litespeed cache.
    The sites are running nice and fast but one issue I have is that when I login I think the cache is causing some bugs with the CMS.
    Is there a way in PHP to disable Litespeed? It would then just be a case of enabling/disabling if logged in or out
    Thanks
    Dave
     
  2. Tishu

    Tishu Well-Known Member

  3. Thanks for your reply. The tricky thing is when logged into the CMS, you don't enter a folder, the url is unchanged. Therefore there is no admin area to add an .htaccess with the disable cache rules.

    Would this exclude caching if viewing the site via the subdomain "admin" e.g. admin.domain.com?
    Code:
    <IfModule LiteSpeed>
     RewriteEngine On
     RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
     RewriteCond %{HTTP_HOST} ^domain.com [NC] [OR]
     RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
     RewriteCond %{ORG_REQ_URI} !^admin.domain.com
     RewriteRule .* - [E=Cache-Control:max-age=120]
    </IfModule>
     
    Last edited: Mar 14, 2018
  4. NiteWave

    NiteWave Administrator

    please try
    Code:
     RewriteEngine On
     RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
     RewriteCond %{HTTP_HOST} ^domain.com [NC] [OR]
     RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
     RewriteRule .* - [E=Cache-Control:max-age=120]
    
     RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
     RewriteCond %{HTTP_HOST} ^admin.domain.com$ [NC]
     RewriteRule .* - [E=Cache-Control:no-cache]
     
    Last edited by a moderator: Mar 16, 2018
    madesimplemedia likes this.
  5. Thanks. Does this need Litespeed cache to be disabled by default?
     
  6. Works great thanks! :)
     
    Michael A likes this.

Share This Page