Jump to content

Manual:Redirects

From mediawiki.org

For user-oriented information, see Help:Redirects instead

A redirect is a page that contains a line such as: #REDIRECT [[Sandbox]].

Such pages serve as "symbolic links" to their target page; in most contexts referring to the redirect page (linking to it, using it as a template, using it as a file name etc.) will have the same result as referring to the target page.

Database

[edit source]

Redirects are recorded in the redirect table.

PHP methods

[edit source]

A selection:

  • Title:
    • Title::isRedirect (bool) - checks if the current Title is a redirect.
    • Title::getRedirectsHere() - gets all extant redirects to the current Title.
    • Title::isValidRedirectTarget() (bool) - checks if the current Title is a valid redirect target.
  • WikiPage :
    • WikiPage::isRedirect() (bool) - checks if the current WikiPage is a redirect.
    • WikiPage::getRedirectTarget() - deprecated since 1.38
    • WikiPage::getQueryInfo() - returns info that can be used to check if the current WikiPage is a redirect.
    • WikiPage::followRedirect()
    • WikiPage::getRedirectURL()
    • WikiPage::insertRedirect()
    • WikiPage::insertRedirectEntry()
    • WikiPage::updateRedirectOn()
  • RedirectStore (unstable):
    • RedirectStore::getRedirectTarget() - get the target WikiPage of the redirect (if the current WikiPage is a direct).

Configuration

[edit source]

Configuration settings relevant to redirects include:

Double redirects

[edit source]

There are several ways to fix double redirects. fixDoubleRedirects.php is a maintenance script that fulfils that purpose. $wgFixDoubleRedirects is a configuration setting that can take care of such redirects as they are created, but it is only suitable for use on a private wiki because page move vandalism causes problems when it is set to true.

Code stewardship

[edit source]

See also

[edit source]