Jason
Jason

Reputation: 542

Redirect MediaWiki page to external page

I'd like to redirect a page (on a MediaWiki site) to an external page on the same domain.

However, I don't want any user to be able to add this redirection or remove it except myself (the admin). I would happily do this with the core/internal files if need be.

Upvotes: 2

Views: 2032

Answers (2)

Protonotarios
Protonotarios

Reputation: 601

Use Extension:ExternalRedirect.

The trick is to allow external redirects only in a namespace that is editable only by the sysops and the redirectors user group. So, in the example given by the extension, first you create the namespace "Moved", make it editable by sysops and redirectors, then enable extension only in that namespace.

In LocalSettings.php:

define("NS_MOVED", 500)
$wgExtraNamespaces[NS_MOVED] = "Moved";
$wgNamespaceProtection[NS_MOVED]=array('redirector');
$wgNamespacesWithSubpages[NS_MOVED]=false;
$wgGroupPermissions['sysop']['redirector']=true;
require_once("$IP/extensions/ExternalRedirect/ExternalRedirect.php");
$wgExternalRedirectNsIDs = array(500);

Upvotes: 1

skalee
skalee

Reputation: 12665

Add some JavaScript to MediaWiki:Common.js which would perform redirect when some condition occurs.

Alternative solution is to write a MediaWiki extension and introduce yet another tag for such redirections, but it seems to be an overkill to me.

Upvotes: 0

Related Questions