Performance and monitoring
LiteSpeed Cache for MediaWiki: install and configure
Our servers use LiteSpeed, which has a built-in page cache. The LiteSpeedCache extension for MediaWiki, made by LiteSpeed itself, connects the wiki to that cache: each page is generated once and the server serves subsequent visits directly. When someone edits an article, the extension purges only that page. It works with MediaWiki 1.25 and later.
1. Upload the extension
- Download the ZIP of the latest version from the extension's releases on GitHub.
- Unzip it on your computer. Inside you will find the LiteSpeedCache folder.
- Upload that folder to MediaWiki's
extensionsfolder with cPanel's File Manager or over FTP. It should end up asextensions/LiteSpeedCache.
If you manage MediaWiki with Composer, you can install it with composer require litespeed/lscache-mediawiki from the wiki's folder.
2. Load it in LocalSettings.php
Edit LocalSettings.php and add this at the end:
wfLoadExtension('LiteSpeedCache');
To check that it has loaded, open Special:Version on your wiki: LiteSpeedCache should appear in the list of extensions.
3. Add the rule to .htaccess
Edit the .htaccess file in the MediaWiki folder and add this at the beginning:
<IfModule LiteSpeed> CacheLookup on </IfModule>
If you use the MobileFrontend extension, also add this block so that the mobile version is cached separately:
<IfModule LiteSpeed> RewriteEngine On RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC] RewriteRule .* - [E=Cache-Control:vary=ismobile] RewriteRule .* - [E=Cache-Vary:stopMobileRedirect,mf_useformat] </IfModule>
4. Enable the cache
Log in as an administrator and go to Special pages (Special:SpecialPages). In the Data and tools section you will find LiteSpeed Cache:

Click Edit and turn on LiteSpeedCache Enabled. From here you can also set how long pages are kept, enable the private cache for logged-in users and purge the whole cache.

Check that it works
Open a wiki page in a private window, press F12, go to Network and reload twice. On the HTML document, the X-LiteSpeed-Cache header should change from miss to hit. Edit a test page and check that the change is visible without logging in.
If the wiki is private (it can only be read with a user account), leave the public cache turned off and use only the private one.
To uninstall it, turn it off on its special page and remove the line from LocalSettings.php, the block from .htaccess and the extensions/LiteSpeedCache folder.
You may also find useful
- Integrate LiteSpeed Cache with Laravel Integrate the LiteSpeed server cache with Laravel using Composer and apply the package's middleware...
- LiteMage Cache in Magento 2: install and configure Install LiteMage in Magento 2 over SSH with Composer, enable it with bin/magento, add LiteMage on to...
- LiteSpeed Cache for Drupal: install and set up Install the LiteSpeed Cache module on Drupal 10 or 11 with Composer and Drush, add the directives to...
- AccelerateWP: what it is, how to turn it on in cPanel and what each option does Turn on AccelerateWP for your WordPress from cPanel, understand what each section of the plugin does...
Something wrong or out of date? Tell us and we will review it.