This is an old revision of the document!
LSCache Plugin for XenForo 2
This guide is intended for XenForo 2.x users. For XenForo 1.x installation instructions click here.
Installation
- Disable any other page caches as these will interfere with LSCXF2.
- Access the server hosting your XenForo installation, either directly or using ssh/sftp.
- From the unzipped LSCXF2 folder, copy all files under
upload
to the root directory of your XenForo 2 installation. - In the XenForo control panel, navigate to the Add-ons section to complete the installation.
Configuration
Once you have downloaded and installed the plugin package, edit the .htaccess
file in the XenForo root directory with the code shown below, making the following changes where appropriate:
- The default cookie prefix set for XenForo is
xf_
, so all cookies set by xenForo will begin with this prefix (xf_user
,xf_session_admin
, etc). If you have changed the cookie prefix in the XenForo configuration file, please make sure to update allxf_COOKIE_NAME
cookies in the rewrite rules below to use the correct prefix. For example, if your set cookie prefix ismyXF_
you would updatexf_user
tomyXF_user
and so on. - If you want to cache for more or less than 360 seconds, change
360
to the number of seconds you wish. (Recommended < 10 minutes):
# LiteSpeed XenForo cache <IfModule litespeed> CacheLookup public on RewriteEngine On # cache RewriteCond %{HTTP_COOKIE} !(xf_lscxf_logged_in|xf_user|xf_session_admin) [NC] RewriteCond %{REQUEST_URI} !/install/ [NC] RewriteRule .* - [E=Cache-Control:max-age=360] # no cache RewriteCond %{HTTP_COOKIE} (xf_lscxf_logged_in|xf_user|xf_session_admin) [NC] RewriteRule .* - [E=Cache-Control:vary=loggedin,E=Cache-Control:no-cache] </IfModule>
Notes
- TTL in LSCXF2 is currently controlled by rewrite rules. There is currently no tag-based purge available (though, we are working on it for the future). Because of this, it is recommended that you use a small TTL (less than 10 minutes, or 600 seconds). A small TTL minimizes the chances of serving stale content.
- Only non-logged-in users are served from cache.
- LSCXF2 is developed specifically for XenForo 2.x. If you are running a XenForo 1.x forum, please use LSCache for XenForo 1.