Extension:SuppleRedirect

MediaWiki extensions manual
SuppleRedirect
Release status: stable
Implementation Link markup
Description replace red-link to redirect other site automatically.
Author(s) Kimagurenote (Corytalk)
Latest version 1.0.0
MediaWiki 1.35+
Database changes No
License BSD 3-clause "Modified" License
Download https://kimagurenote.net/kn/SuppleRedirect#Download
https://kimagurenote.net/kn/SuppleRedirect#History
Example https://kimagurenote.net/kn/SuppleRedirect#Usage

The SuppleRedirect extension provides a way to replace red links to redirect other site automatically if find same title on other sites by MediaWiki REST API (1.35+).

And set redirect automatically on new page also.

It useful to divide your site or build new sites.

Installation

edit
  • Download zip file from author's website, unzip it and place the file(s) in a directory called SuppleRedirect in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    /* Extension:SuppleRedirect */
    wfLoadExtension( 'SuppleRedirect' );
    $wgSuppleRedirectRestURL['my'] = "https://mywiki.example.com/rest.php";
    $wgSuppleRedirectBaseURL['my'] = "https://mywiki.example.com/mywiki/";
    $wgSuppleRedirectRestURL['en'] = "https://en.wikipedia.org/w/rest.php";
    $wgSuppleRedirectBaseURL['en'] = "https://en.wikipedia.org/wiki/";
    $wgSuppleRedirectRestURL['ja'] = "https://ja.wikipedia.org/w/rest.php";
    $wgSuppleRedirectBaseURL['ja'] = "https://ja.wikipedia.org/wiki/";
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

edit

Permanently redirect

edit

If you want to redirect permanently (e.g. using to divide your site), add this variable to LocalSettings.php.

$wgSuppleRedirectPermanently = true;

By default (if not set), may be used 307 Temporary Redirect.

Exclude some titles

edit

If you want to exclude some titles, you can set $wgSuppleRedirectExcludes on LocalSettings.php as follows.

$wgSuppleRedirectExcludes = [ "Example", "Test" ];

You must set uppercase the first character because of MediaWiki's restriction.

But you may not restricted with $wgCapitalLinks = false.

Timeout

edit

This extension timed out 60 seconds by default to call MediaWiki Rest API.

We recommend to set shorten "default_socket_timeout" on php.ini as possible.

Notes

edit

Create new page

edit

This extension replace red links automatically if same article provided on other site worked MediaWiki.

If you want to create a new page, open the full URL with redirect=no. for example:

https://yourwiki.example.com/index.php?redirect=no&title=New_article

e.g. on wikitext:

[{{fullurl:New article|redirect=no}} Create "new article" on this site]

Namespace problems

edit

This extension works only workspaces NS_MAIN or $wgContentNamespaces.

This extension may meet problems being caused by translation in several namespaces (except NS_MAIN) and languages. details see here. (in Japanese)

Miscellaneous

edit

This extension not affect by $wgInvalidRedirectTargets.

See also

edit