Help:Redirect: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Translation tweaks.
Removing documentation → to MediaWiki.org
Line 1: Line 1:
<languages />
<languages />
{{ambox|text=<translate>For technical documentation about redirects, please visit [[<tvar name=1>Special:MyLanguage/Help:Redirects</tvar>|dedicated help page on Mediawiki.org]].</translate>}}
{{H:h|reader toc}}
:''<translate>See also: [[w:Wikipedia:Redirect|Wikipedia:Redirect]]</translate>''
<translate>
A '''redirect''' is a page that automatically redirects the reader's browser to a specified target page. Redirects are used to help users locate information and keep wikis organized, so that multiple names, abbreviations, misspellings, or related topics can all point to the same page.


A redirect is created by the text
</translate>
<nowiki>#REDIRECT [[</nowiki>''<translate>name of the target page</translate>''<nowiki>]]</nowiki>
<translate>
<translate>
'''Redirects''' have different use cases through Wikimedia wikis.
As an example, if the page "<tvar name="1">Foo</tvar>" starts with the line <tvar name="2"><code><nowiki>#REDIRECT [[Bar]]</nowiki></code></tvar>, then the persons who visit the page "<tvar name="1">Foo</tvar>" will be shown the page "<tvar name="3">Bar</tvar>" with a note that they were redirected from "<tvar name="1">Foo</tvar>". The page "<tvar name="3">Bar</tvar>" does not need anything in it to be the target of the redirection.


== Local policies ==
Any text thereafter is ignored and is rendered only in a diff.


Some projects have policies on ''what'' redirects should exist. For example, on the [[<tvar name="1">wiktionary:</tvar>|English Wiktionary]], most redirects are prohibited by policy.
== Appearance ==


=== Broken redirects ===
If the redirect target is an existing page in the same project, going to the redirect page by means of a link, the [[w:URL|URL]], or the Go button, results in the redirect target page, just like following the link. However, the browser shows the URL of the redirect page, and the target page shows a small notice after the top title to indicate you arrived here indirectly.


On many wikis administrators simply delete them, but it is sometimes useful to keep a broken redirect and wait for the creation of the target, or to set a new target.
For example, if somebody goes to redirection, then they will end up at this page instead, and the beginning of the page will look like:
</translate>
<blockquote style="background-color: white; color: black; border: 1px solid black; padding: 1em;">
<h1 class="firstHeading">Help:Redirect</h1>
<h3 id="siteSub">{{int:Tagline}}</h3>
<div id="contentSub">{{int:Redirectedfrom|[[Help:Redirection]]}}</div>
</blockquote>
<translate>
To get the canonical URL of the target page in your browser's address bar, click the article tab.

If the redirect target is a non-existing page in the same project, or to a page in another project, one simply arrives at the redirect page.

When a page called for inclusion is a redirect page, the redirect target is included instead, with the same parameters, without any redirect message. A double redirect does not work (see further).

== Restrictions ==

On visiting any page on a simple chain of redirects, the browser is redirected to the final destination. If the chain forms a loop, the browser is brought to its predecessor and the redirect loop is displayed. See, e.g., <tvar name="1">[[/Redirect 1/]]</tvar> &rarr; <tvar name="2">[[/Redirect 2/]]</tvar> &rarr; <tvar name="3">[[/Redirect 3/]]</tvar> &rarr; <tvar name="4">[[/Redirect 1/]]</tvar>.

A redirect target cannot depend on a variable, template, or parser function. If that is the case, the browser will not be automatically redirected on visiting the page. See, e.g., <tvar name="1">[[/expr/]]</tvar>.

A code like %70 in a redirect disables it, although the link works from the redirect page.

Some projects have policies on ''what'' redirects should exist. For example, on the [[<tvar name="1">wiktionary:</tvar>|English Wiktionary]], most redirects are prohibited by policy.


== Purposes of a redirect ==
== Purposes of a redirect ==
Line 51: Line 23:
* <translate>Provide a way of conveniently going to a page (shortcut).</translate>
* <translate>Provide a way of conveniently going to a page (shortcut).</translate>
* <translate>Keep links to a page active after it has been moved (even if internal links are updated, this still applies for links from outside; also for [[<tvar name="1">Special:MyLanguage/Help:Edit summary#Internal and interwiki links in edit summaries</tvar>|links in edit summaries]]).</translate>
* <translate>Keep links to a page active after it has been moved (even if internal links are updated, this still applies for links from outside; also for [[<tvar name="1">Special:MyLanguage/Help:Edit summary#Internal and interwiki links in edit summaries</tvar>|links in edit summaries]]).</translate>

<translate>
<translate>
=== Special purposes ===
=== Special purposes ===
Line 56: Line 29:
* <translate>Conveniently linking indirectly to a page, without the need for a [[<tvar name="1">Special:MyLanguage/Help:Piped link</tvar>|piped link]]. However, a piped link is in some respects even better than relying on a redirect.</translate>
* <translate>Conveniently linking indirectly to a page, without the need for a [[<tvar name="1">Special:MyLanguage/Help:Piped link</tvar>|piped link]]. However, a piped link is in some respects even better than relying on a redirect.</translate>
* <translate>Allowing a link title independent of the final link target; one creates a page whose name is the desired link title, and which redirects to the desired target page. See e.g. <tvar name="q">[[w:Template:Ft]]</tvar>, containing <tvar name="2"><nowiki>[[30.48 cm|ft]]</nowiki></tvar>, with the page <tvar name="3">[[w:30.48 cm]]</tvar> redirecting to <tvar name="4">[[w:Foot (unit of length)]]</tvar>. The link title "<tvar name="5">30.48 cm</tvar>" informs in the hover box about the unit "ft" even without following the link to the article about this unit. See also <tvar name="6">{{ll|Help:Advanced editing}}</tvar> for another technique with a similar result.</translate>
* <translate>Allowing a link title independent of the final link target; one creates a page whose name is the desired link title, and which redirects to the desired target page. See e.g. <tvar name="q">[[w:Template:Ft]]</tvar>, containing <tvar name="2"><nowiki>[[30.48 cm|ft]]</nowiki></tvar>, with the page <tvar name="3">[[w:30.48 cm]]</tvar> redirecting to <tvar name="4">[[w:Foot (unit of length)]]</tvar>. The link title "<tvar name="5">30.48 cm</tvar>" informs in the hover box about the unit "ft" even without following the link to the article about this unit. See also <tvar name="6">{{ll|Help:Advanced editing}}</tvar> for another technique with a similar result.</translate>

<translate>
<translate>
When creating new redirects, bear in mind that creating too many redirects can clutter up the [[<tvar name="1">Special:MyLanguage/Help:Searching</tvar>|search results page]], which can hinder users. Also, don't spend too much time creating redirects. Often it's more important to spend time improving the quality of the target page. A piped link is another way to make a link to a page with a name which does not occur in the first page.
When creating new redirects, bear in mind that creating too many redirects can clutter up the [[<tvar name="1">Special:MyLanguage/Help:Searching</tvar>|search results page]], which can hinder users. Also, don't spend too much time creating redirects. Often it's more important to spend time improving the quality of the target page. A piped link is another way to make a link to a page with a name which does not occur in the first page.


== Using redirects for inexisting but expected pages ==
== Creating a redirect ==


When an inexisting page Subtopic could be created as a subtopic of Topic page, there are the following possibilities:
If you are creating a new redirect, [[<tvar name="1">Special:MyLanguage/Help:Starting a new page</tvar>|start a new page]], write <tvar name="2"><code><nowiki>#REDIRECT [[page name]]</nowiki></code></tvar> (or <tvar name="4"><code><nowiki>#redirect [[page name]]</nowiki></code></tvar>) at the beginning of the page, where <tvar name="5">''page name''</tvar> is the name of the target page. Here is [<tvar name="url">https://meta.wikimedia.org/w/index.php?title=redirection&action=edit&redirect=no</tvar> an example]. If you are replacing an existing page with a redirect, for example after merging a duplicate page, go to the page, edit it, and replace the existing text with <tvar name="2"><code><nowiki>#REDIRECT [[page name]]</nowiki></code></tvar>.

The page will not redirect if there is anything on the page ''before'' the redirect. Also, there must be no spaces between the # and the REDIRECT.

Extra text ''after'' the <tvar name="1"><code>#REDIRECT</code></tvar> command and link is ignored. It is rendered only in a diff, see [<tvar name="url">https://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&action=edit</tvar> here], [<tvar name="url2">https://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&diff=356885&oldid=356884</tvar> here], and [<tvar name="url3">https://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&redirect=no</tvar> here]. Category tags are not ignored. If a category is set, the redirect-page is listed in the category it belongs to. When following the link from the category page to the redirect page, then as usual the redirect is ''applied''.

An [[<tvar name="1">Special:MyLanguage/Help:Edit summary</tvar>|edit summary]] is automatically provided, as displayed at <tvar name="2">[[MediaWiki:Autoredircomment]]</tvar>, but only if no edit summary is supplied (as opposed to the automatic edit summary in section editing, which can be supplemented by the user).

== Rendering of the redirect page ==

After you save the redirect page, you get sent to a page with the string "<tvar name="1"><code>&redirect=no</code></tvar>" in the URL. Thus the just created redirect page is shown, not the page to which it redirects. The redirect page should look something like:
</translate>
</translate>
# <translate>Redirect Subtopic to Topic, use the [[<tvar name="1">mw:Special:MyLanguage/Help:What links here</tvar>|backlink]] to go from A to B (disadvantage: not very inviting to create a new content page B; inconvenient if A has many backlinks).</translate>
<blockquote style="background-color: white; color: black; border: 1px solid black; padding: 1em;">
# <translate>Insert a red link in Topic to Subtopic as invitation or preparation for creating page Subtopic; use the backlink to go from Subtopic to Topic (disadvantage: not obvious for newbie, much less convenient than automatic redirect, especially if B has many backlinks).</translate>
<h1 class="firstHeading">Help:Redirection</h1>
# <translate>Both (indirect self-link on Topic). To go from Topic to Subtopic, click the link from Topic to Subtopic, which brings you back to Topic, and use the link in the redirect message (for detecting a redirect see hereinbefore; however, there is no distinction between a redirect back, and an onward redirect) (disadvantage, as far as not yet mentioned: not obvious for newbie).</translate>
<h3 id="siteSub"><translate nowrap>From <tvar name="1">{{ns:project}}</tvar>, a Wikimedia project coordination wiki</translate></h3>
# <translate>Ditto but with a soft redirect from Subtopic to Topic, i.e. a page only containing something like "See [<nowiki/>[Topic]]"; one can see at Topic that Subtopic is very short using the [[<tvar name="1">Special:MyLanguage/Help:Link#Stub feature</tvar>|stub feature]] (disadvantages: a soft redirect is non-standard; people who do not know about its reason may change it in a regular redirect; is a little less convenient than automatic redirect; requires stub feature setting)</translate>
<div id="contentSub"><translate nowrap>Redirect page</translate></div>
# <translate>Subtopic is a redirect, link from Topic to Subtopic with "<tvar name="code"><code>redirect=no</code></tvar>" parameter, or link to Subtopic's edit page, e.g. [<tvar name="url">https://meta.wikimedia.org/w/index.php?title=Template&redirect=no</tvar> Template] and [<tvar name="url2">https://meta.wikimedia.org/w/wiki.phtml?title=Template&action=edit</tvar> start page Template], respectively.</translate>
[[File:Redirectltr.png]] <span class="redirectText">Help:Redirect</span>
</blockquote>
<translate>
After the page title, the content of <tvar name="1">[[MediaWiki:Redirectpagesub]]</tvar> (by default the text "Redirect page"), a bent arrow, and the link to the redirect target is rendered. This link shows the canonical form of the target. As mentioned previously, the text after the link to the redirect target is ignored, except for category tags.


To see your redirect working, use your address bar to delete that part of the URL. Alternatively, create a link on another page to your redirect, and then follow that link.

== Changing a redirect ==

When changing a redirect target to a different page, or turn a redirect page into a regular page, you must go to the redirect page. To do so, click on a link to the redirect page. Then look for the link to the redirect page at the top of the page you've been redirected to; e.g.
<tvar name="1"><div id="contentSub">(Redirected from [[Help:Redirect]]ion)</div></tvar>

Once you get to the redirect page, click '''Edit this page'''. You can then either change the target of the redirect, replace the redirect with a brand new page or revert to an earlier version of the article, before it became a redirect.

Another way to get to the redirect page: Go to the target page, and click "What links here". This will show you all the back-links from that page, including redirects. To change a redirect, click on it, and then click on '''Edit this page''' as previously.

== Broken redirects ==

A broken redirect is a redirect whose target page does not exist. This type of redirect does not function and redirection will not occur. Broken redirects are logged at <tvar name="1">[[Special:BrokenRedirects]]</tvar>.

On many wikis administrators simply delete them, but it is sometimes useful to keep a broken redirect and wait for the creation of the target, or to set a new target. For an example, see <tvar name="2">[[Help:Redirect/Broken redirect]]</tvar>.

== Template redirects ==

Calls to a template that redirects to another template will result in the transclusion and function of the target template. Double redirects and broken redirects do not work as usual. See also [[<tvar name="1">Special:MyLanguage/Help:Template#Redirection</tvar>|the help page on templates]].

For example, we have the chain <tvar name="1">[[/double redirect]]</tvar> &rarr; <tvar name="2">[[/single redirect]]</tvar> &rarr; <tvar name="3">[[/Target]]</tvar>. The template call <tvar name="4"><code><nowiki>{{/double redirect}}</nowiki></code></tvar> is rendered as:
</translate>
{{/double redirect}}
<translate>
<translate>
In the 3rd and 4th cases, especially if Topic has a list of links to pages Subtopic, one can mark the links with more info, e.g. by bolding, and explain the marking.
== Moving a page ==

When a page is [[<tvar name="1">Special:MyLanguage/Help:Moving a page</tvar>|moved]], a redirect from the old to the new pagename is automatically created.

If the new pagename is occupied by a redirect that has only one edit in its history and targeted to the old page name, it is replaced by the page being moved. If the redirect has more than one history entry, or the redirect target is somewhere else, then it can only be deleted-and-moved by an administrator.

== Redirect to special targets ==

=== Interwiki redirects and redirects to special pages ===

Interwiki redirects and redirects to special pages have been disabled, try e.g. <tvar name="1">{{ll|Help:Interwiki redirect demo}}</tvar> and [[<tvar name="2">Special:Specialpages</tvar>|Help:Redirect to special page demo]].

Use direct [[<tvar name="1">Special:MyLanguage/Help:Interwiki linking</tvar>|interwiki link]]s (or direct links to Special pages) without redirect, or a [[w:Wikipedia:Soft redirect|soft redirect]] (non-automatic).

=== A redirect to an anchor ===

One may redirect to an anchor, in particular a section. [[<tvar name="1">Special:MyLangauge/Help:Section#Section linking and redirects</tvar>|Help:Section linking and redirects]] is an example and its target also provides more info. ('''It does not work for every environment.''')

One method is the following syntax: <tvar name="1">'''<nowiki>#REDIRECT [[target_page#section_title]]</nowiki>'''</tvar>
</translate>
<!-- "Start with 2 '[' ", "target_page", "#", "section_title" "end with 2 '] " using a "#" rather than a ":". -->
<translate>
Section redirects are supposed to work from r18220 onwards. See <tvar name="1">[[bugzilla:218]]</tvar>. If it does not work, you will be redirected to the correct page but you will not be sent to the intended section.

=== A redirect to a page in the image or category namespace ===

On Meta and Wikipedia a redirect to an image page or to a category shows the editable text only. To get the full page after being redirected, use the link "File", or "Category", respectively.

On Commons a redirect to a category gives the full page, but not the subcategories and pages in the redirect page (if that is also a category).

To prevent a page that redirects to a category from appearing in the category; precede the word Category with a colon like so :
</translate>
<code><nowiki>#REDIRECT [[:Category:Glossary]]</nowiki></code>
<translate>
=== A redirect from a category page to another category page ===

As with normal pages, (on Meta, others not tested) a category page itself can be redirected to another category page. This is useful when many different article pages have been assigned to variations or aliases of the same "proper" category, even if only as a temporary fix until all are unified. For example, pages assigned to <tvar name="1">UNorg</tvar>, <tvar name="2">United Nations</tvar>, and <tvar name="3">UnitedNations</tvar> would all obviously refer to the one proper <tvar name="5">[[w:Category:United Nations|Category:United Nations]]</tvar> so each would be redirected there as above. In addition, to help manage the list of such alias-redirects, they can all be assigned to one common subcategory under the proper category.

For a live example, aliases <tvar name="1">[[:category:$1x | category:$1x ]]</tvar> and <tvar name="2">category:$1y</tvar> redirect to proper <tvar name="3">[[:category:$1 | category:$1]]</tvar> while <tvar name="4">[[:category:$1r | sub-category:$1r of $1]]</tvar> holds the alias list. ''Note: Editors please make $1y and then rename all these pages with clearer names - TY!''

=== Images linking to a specific page ===

There are ways to make an image link to a specified page, some which work especially well on Mediawiki sites that support embedding external images. For possibilities, see <tvar name="1">{{ll|Help:Navigational image}}</tvar>. By Dee Driscoll appointee for US Attorney's Office Washington DC.

== CSS class ==

With the new preprocessor an internal link to a redirect page has CSS class "<tvar name="1"><code>mw-redirect</code></tvar>". This can be useful to make them stand out, for clean-up work involving bypassing redirects.

== Redirect and/or link to non-existing page ==

When B is a subtopic of A, and B does not have its own page, or at least not with additional info, there are the following possibilities:
</translate>
# <translate>Redirect B to A, use the [[<tvar name="1">mw:Special:MyLanguage/Help:What links here</tvar>|backlink]] to go from A to B (disadvantage: not very inviting to create a new content page B; inconvenient if A has many backlinks).</translate>
# <translate>Link A to B ("[[w:Wikipedia:Red link|red link]]") as invitation or preparation for creating page B; use the backlink to go from B to A (disadvantage: not obvious for newbie, much less convenient than automatic redirect, especially if B has many backlinks).</translate>
# <translate>Both (indirect self-link on A). To go from A to B, click the link from A to B, which brings you back to A, and use the link in the redirect message (for detecting a redirect see hereinbefore; however, there is no distinction between a redirect back, and an onward redirect) (disadvantage, as far as not yet mentioned: not obvious for newbie).</translate>
# <translate>Ditto but with a [[w:Wikipedia:soft redirect|soft redirect]] from B to A, i.e. a page only containing something like "See <tvar name="1"><nowiki>[[</nowiki>A]]</tvar>"; one can see at A that B is very short using the [[<tvar name="2">Special:MyLanguage/Help:Link#Stub feature</tvar>|stub feature]] (disadvantages: a soft redirect is non-standard; people who do not know about its reason may change it in a regular redirect; is a little less convenient than automatic redirect; requires stub feature setting)</translate>
# <translate>B is a redirect, link from A to B with "<tvar name="1"><code>redirect=no</code></tvar>", or link to B's edit page, e.g. [<tvar name="url">https://meta.wikimedia.org/w/index.php?title=Template&redirect=no</tvar> Template] and [<tvar name="url2">https://meta.wikimedia.org/w/wiki.phtml?title=Template&action=edit</tvar> start page Template], respectively.</translate>
<translate>
In the 3rd and 4th cases, especially if A has a list of links to pages B, one can mark the links with more info, e.g. by bolding, and explain the marking.


== See also ==
== See also ==
Line 179: Line 58:
* [[mw:Special:MyLangauge/Manual:Page table|<translate>Page database table manual for how redirects are stored</translate>]]
* [[mw:Special:MyLangauge/Manual:Page table|<translate>Page database table manual for how redirects are stored</translate>]]


[[Category:Redirects{{#translation:}}| ]]
{{H:f|langs=|enname=Redirect}}

[[Category:Reader handbook{{#translation:}}]]
[[Category:Redirects{{#translation:}}]]

Revision as of 17:09, 12 April 2022

Redirects have different use cases through Wikimedia wikis.

Local policies

Some projects have policies on what redirects should exist. For example, on the English Wiktionary, most redirects are prohibited by policy.

Broken redirects

On many wikis administrators simply delete them, but it is sometimes useful to keep a broken redirect and wait for the creation of the target, or to set a new target.

Purposes of a redirect

  • Allow access in the case that a page name is provided:
    • which is an alternative name for the subject
    • which is a name for a subtopic (in this case one may use a redirect to a section)
    • which uses alternative capitalization and hyphenation
    • which uses alternative spelling
    • which has a common misspelling
  • Provide a way of conveniently going to a page (shortcut).
  • Keep links to a page active after it has been moved (even if internal links are updated, this still applies for links from outside; also for links in edit summaries).

Special purposes

  • Conveniently linking indirectly to a page, without the need for a piped link. However, a piped link is in some respects even better than relying on a redirect.
  • Allowing a link title independent of the final link target; one creates a page whose name is the desired link title, and which redirects to the desired target page. See e.g. w:Template:Ft, containing [[30.48 cm|ft]], with the page w:30.48 cm redirecting to w:Foot (unit of length). The link title "30.48 cm" informs in the hover box about the unit "ft" even without following the link to the article about this unit. See also Help:Advanced editing for another technique with a similar result.

When creating new redirects, bear in mind that creating too many redirects can clutter up the search results page, which can hinder users. Also, don't spend too much time creating redirects. Often it's more important to spend time improving the quality of the target page. A piped link is another way to make a link to a page with a name which does not occur in the first page.

Using redirects for inexisting but expected pages

When an inexisting page Subtopic could be created as a subtopic of Topic page, there are the following possibilities:

  1. Redirect Subtopic to Topic, use the backlink to go from A to B (disadvantage: not very inviting to create a new content page B; inconvenient if A has many backlinks).
  2. Insert a red link in Topic to Subtopic as invitation or preparation for creating page Subtopic; use the backlink to go from Subtopic to Topic (disadvantage: not obvious for newbie, much less convenient than automatic redirect, especially if B has many backlinks).
  3. Both (indirect self-link on Topic). To go from Topic to Subtopic, click the link from Topic to Subtopic, which brings you back to Topic, and use the link in the redirect message (for detecting a redirect see hereinbefore; however, there is no distinction between a redirect back, and an onward redirect) (disadvantage, as far as not yet mentioned: not obvious for newbie).
  4. Ditto but with a soft redirect from Subtopic to Topic, i.e. a page only containing something like "See [[Topic]]"; one can see at Topic that Subtopic is very short using the stub feature (disadvantages: a soft redirect is non-standard; people who do not know about its reason may change it in a regular redirect; is a little less convenient than automatic redirect; requires stub feature setting)
  5. Subtopic is a redirect, link from Topic to Subtopic with "redirect=no" parameter, or link to Subtopic's edit page, e.g. Template and start page Template, respectively.

In the 3rd and 4th cases, especially if Topic has a list of links to pages Subtopic, one can mark the links with more info, e.g. by bolding, and explain the marking.

See also