CarenodiMW is a mediawiki extension that adds the rel=canonical and the meta=refresh tags to pages which wikitext matches a regexp-based configuration.
Note that this extension manages both features as HTML tags, not as HTTP headers.
- Current version requires
MediaWiki >=1.39
. Use release v0.99.2 forMediaWiki >=1.31 <1.36
. - Download and unzip it (or clone this git repo).
- Copy the folder as
CarenodiMW
within theextensions
directory of your mediawiki site.
Edit LocalSettings.php
and add the following, configuring the settings to suit your needs.
wfLoadExtension('CarenodiMW'); // Load me!
// Base URL to be used for all the canonical and refresh tags.
$wgCarenodiMW_base = 'https://example.com';
// Regular expression to extract the path for the canonical tags.
// The first captured group in the regular expression will be used.
// Any empty value disables the feature globally.
$wgCarenodiMW_canonical_regexp = '/new location is (.*) this/';
// Regular expression to extract the path for the refresh tags.
// The first captured group in the regular expression will be used)
// Any empty value disables the feature globally.
// (note that, normally, it will be the same than the canonical one
// but it's possible to specify different one).
$wgCarenodiMW_refresh_regexp = '/new location is (.*) this/';
// Number of seconds to perform the refresh to new URL (0 = immediate).
$wgCarenodiMW_refresh_wait = 5;
// Enable separate debug for the extension
// $wgDebugLogGroups['CarenodiMW'] = '/tmp/CarenodiMW.log';
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
BSD 3-Clause - Copyright (c) 2022 onwards, Eloy Lafuente (stronk7).