Manual:Redirects
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
editRedirects are recorded in the redirect table.
PHP methods
editA 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
editConfiguration settings relevant to redirects include:
- $wgDebugRedirects (defaults to false), displays redirect location instead of actually redirecting to the target URL.
- $wgDisableHardRedirects (defaults to false), disables redirects to special pages and interwiki redirects, which use a 302 and have no "redirected from" link.
- $wgInvalidRedirectTargets (defaults to
array( 'Filepath', 'Mypage', 'Mytalk' )
) is an array of invalid page redirect targets. - $wgMaxRedirectLinksRetrieved (defaults to 500), is the maximum number of links to a redirect page listed on Special:Whatlinkshere/RedirectDestination.
- $wgRedirectSources (defaults to false), is a regular expression to restrict URLs which will be displayed as 'redirected from' links.
Double redirects
editThere 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- Maintained by Unknown or Unassigned[Maintainers page].
- Issue tracker: Phabricator MediaWiki-redirects (Report an issue)