MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: beta
Implementation Link markup , Special page
Description Allows links to caches of externally linked websites. Also, includes ability to cache linked web pages locally on Wiki server.
Author(s) Iowajasontalk
Latest version .8 (2014-06-04)
MediaWiki 1.15
License No license specified
Translate the WebCache extension if it is available at translatewiki.net
Check usage and version matrix.

The WebCache extension allows access to external links via a web archive. The extension integrates with several popular web archives as well as supporting a local spider to cache pages on your web server.

The extension can place an icon for a link after the link to send the user to the cached version of the page. Alternatively, the extension can be configured to eliminate the original URL link and always send users to the specified cache. This setting is on a per wiki basis and can not be changed based on page status.

The extension offers administrators the option to cache locally on their wiki server external content. This local cache option could present security issues and administrators should weigh carefully whether they trust their authors and linked content sufficiently to save it locally on their server. There are a number of security related settings to control this risk. This was initially designed for kiosk like functionality where a mobile server may only intermittently have Internet access and still want to have all links functional when not connected. Cached files are not parsed when served, only transferred by the web server. The DOM is parsed by the wiki's PHP engine, but scripts should not be executed. Only http or https URLs are cached (mailto and FTP specifically are unsupported).



External cacheEdit


Internal cacheEdit

If using the local PHP/Wiki based cache mechanism provided with this extension, PHP FileInfo must be enabled.


Local cacheEdit

if using another local cache and update from Wiki is desired, your web server will need executable access to the file.

Install ExtensionEdit

Copy into the extensions folder.

Enable ExtensionEdit

In LocalSettings.php, add the line


The default configuration included with the extension keeps the original link intact and appends a text link following the URL that links to the webcache.


Three routes based on desired target cache system.

External cacheEdit

This is the default of the installation. To switch later set "$WebCacheSystem = External".

Included cacheEdit

This copies files linked to on the wiki locally. It includes a spider mechanism to update using the Wiki's job system.

  1. set "$WebCacheSystem = PHPWebCache".
  2. If desired, switch the local file directory and URL. The default settings create a "webcache" folder in the root of your wiki installation.

Other local cacheEdit

  1. Set "$WebCacheSystem = LocalWebCache".
  2. Set the baseURL to the base of the cache system.
  3. Set the command line option for cache update.


This option should be used at a minimum to test. First option is to postpend an icon with a link to the cache. Set $WebCacheEnableRewrite to true. Second option is to overwrite any links and force them to go to the cache, leaving no link to the original file. Set $WebCacheForceRewrite to true. This also disables the icon as it is not needed.


In addition to LocalSettings.php settings, there is also an update Special Page that can start an update on the cache (necessary for the included local cache option). Only users with 'manage_WebCache' right can access this page. Give a person or group this right.

Secure local cacheEdit

If using local cache, see Extension:WebCache/Security security settings page.

Configuration parametersEdit

There are many and will be explained soon.

User rightsEdit

Depending on the sitewide configuration, all users will see the results of configuration settings for cache on the pages that they view. There is currently no option about who can see links to cached pages.

All rights are related to who can manage the cache. The default installation allows no one to update the cache. LocalSettings.php should allow some group to administer. This example shows how to allow the sysop group the ability to use the administrative page.

$wgGroupPermissions['sysop']['manage_WebCache'] = true;

See alsoEdit