Jump to content

Help:Redirect: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Added "Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)" by Uriah Anthony Stephenson-Ward
Aotake (talk | contribs)
sorting out. A redirect to an anchor does NOT work in my environment.
Line 6: Line 6:
<nowiki>#REDIRECT [[</nowiki>''pagename''<nowiki>]]</nowiki>
<nowiki>#REDIRECT [[</nowiki>''pagename''<nowiki>]]</nowiki>


Where ''pagename'' is the article or page to redirect to. For example, on Wikipedia, the page "Ancient forest" has only the text:
Where ''pagename'' is the article or page to redirect to.

<nowiki>#REDIRECT [[Old growth forest]]</nowiki>

See [[w:Ancient forest|Ancient forest]] for how this appears when a reader goes to the "Ancient forest" article. The "Old growth forest" page should appear from this link. A small notice of the redirect is also displayed (under the top title) to indicate you arrived here indirectly. If you click the link in the notice which reads:
<div id="contentSub">(Redirected from [http://en.wikipedia.org/w/index.php?title=Ancient_forest&redirect=no Ancient forest])</div>
you can see (and edit) the redirection page itself.


==How it appears to the user==
==How it appears to the user==
If the redirect target is an existing page in the same project, going to the redirect page by means of a link, the 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 below the top title to indicate you arrived here indirectly.


For example, if somebody goes to [[Help:Redirection]], then they will end up at this page instead, and the top of the page will look like:
If the link is to an existing page in the same project, going to the redirect (by means of a link, the URL, or the Go button) results in the new page, just like following the link, except that the browser shows the original URL, and the new page shows a redirection message below the title. (To get the canonical URL in your browser's address bar, click the article tab.)

For example, if somebody goes to: [[Help:Redirection]], then they will end up at this page instead, and the top of the page will look like:


<blockquote style="background-color: white; color: black; border:1px solid black; padding: 1em;">
<blockquote style="background-color: white; color: black; border:1px solid black; padding: 1em;">
<h1 class="firstHeading">Help:Redirect<h1>
<h1 class="firstHeading">Help:Redirect<h1>
<h3 id="siteSub">From Meta<h3>
<h3 id="siteSub">From {{ns:project}}<h3>
<div id="contentSub">(Redirected from [[Help:Redirection]])</div>
<div id="contentSub">(Redirected from [[Help:Redirection]])</div>

''(etc)''
</blockquote>
</blockquote>


To get the canonical URL of the target page in your browser's address bar, click the article tab.
If the link is to 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. Again, a double redirect does not work.
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 below).


==Restrictions==
==Restrictions==

As a simple way to avoid problems with infinite [[w:Recursion|recursion]], if the redirect target is another redirect page, the second redirect is not applied.
As a simple way to avoid problems with infinite [[w:Recursion|recursion]], if the redirect target is another redirect page, the second redirect is not applied.


A redirect target cannot depend on a variable, template, or parser function. When attempting this, the restriction does not become apparent in the preview (see also the section below on the rendering of a redirect page), but only after saving.
A redirect target cannot depend on a variable, template, or parser function. When attempting this, the restriction does not become apparent in the preview (see also the section below on the rendering of a redirect page), but only after saving.

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


Note also that different projects have different specifications on ''what'' can be redirected. On en.wiktionary.org, the multilingual dictionary, most redirects are prohibited by policy.
Note also that different projects have different specifications on ''what'' can be redirected. On en.wiktionary.org, the multilingual dictionary, most redirects are prohibited by policy.
Line 53: Line 47:
=== Special purposes ===
=== Special purposes ===
*Conveniently linking indirectly to a page, without the need for a [[Help:Piped link|Piped link]]. However, a piped link is in some respects even better than relying on a redirect, see [[Help:Piped link#Using a redirect as an alternative|Comparison with piped link]].
*Conveniently linking indirectly to a page, without the need for a [[Help:Piped link|Piped link]]. However, a piped link is in some respects even better than relying on a redirect, see [[Help:Piped link#Using a redirect as an alternative|Comparison with piped link]].
*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 <nowiki>[[30.48 cm|ft]]</nowiki>, 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:Editing#Hover_box|hover box]] for another technique with a similar result.
*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 <nowiki>[[30.48 cm|ft]]</nowiki>, 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 [[Help:Searching|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 [[Help:Piped link|piped link]] is another way to make a link to a page with a name which does not occur in the first page.
== The move tool ==


==Creating a redirect==
When a page is renamed/moved with the [[Help:Renaming (moving) a page|Renaming (moving) a page]] function, a redirect is automatically created from the old to the new name, and also one for the corresponding talk page.
If you're creating a new redirect, [[Help:Starting a new page|start a new page]], write <nowiki>#REDIRECT [[pagename]]</nowiki> (or <nowiki>#redirect [[pagename]]</nowiki>) at the top of the page, where ''pagename'' is the name of the target page. Here is [http://meta.wikipedia.org/w/wiki.phtml?title=redirection&action=edit&redirect=no an example]. If you're 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 <nowiki>#REDIRECT [[pagename]]</nowiki>.


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.
If the new page name is occupied by a redirect with only one edit in its history, it is replaced by the page being moved. If the redirect has more than one history entry, then it must either be deleted by an administrator or moved to another name. This move will leave behind a new redirect with no edit history, which can then be replaced by the desired page move. It might be desirable to delete the moved redirect.


Extra text ''after'' the #REDIRECT command and link is ignored. It is rendered in preview only, see [http://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&action=edit] and [http://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&redirect=no]. Category-tags are not ignored. If a category is set, the redirect-page is listed in the category it belongs to, see e.g. {{tim|ddd}}. When following the link from the category page to the redirect page then as usual the redirect is ''applied''.
==Creating a redirect==


An [[Help:Edit summary|edit summary]] is automatically provided, with the text according to [[MediaWiki:Autoredircomment]], 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).
If you're creating a new redirect, [[Help:Starting a new page|start a new page]], write <nowiki>#REDIRECT [[pagename]]</nowiki> (or <nowiki>#redirect [[pagename]]</nowiki>) at the top of the page, where ''pagename'' is the name of the target page. Here is [http://meta.wikipedia.org/w/wiki.phtml?title=redirection&action=edit&redirect=no an example]. If you're 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 <nowiki>#REDIRECT [[pagename]]</nowiki>.


==Rendering of the redirect page==
Extra text ''after'' the #REDIRECT command and link is ignored. It is rendered in preview only, see [http://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&action=edit] and [http://meta.wikimedia.org/w/index.php?title=Talk:MediaWiki_User%27s_Guide:_Using_redirects&redirect=no].
After you save the redirect page, you get sent to a page with the string "&redirect=no" 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:
Category-tags are not ignored. If a category is set, the redirect-page is listed in the category it belongs to, see e.g. {{tim|ddd}}. When following the link from the category page to the redirect page then as usual the redirect is ''applied''.


<blockquote style="background-color: white; color: black; border:1px solid black; padding: 1em;">
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. An [[Help:Edit summary|edit summary]] is automatically provided, with the text according to [[MediaWiki:Autoredircomment]], 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).
<h1 class="firstHeading">Help:Redirection<h1>
<h3 id="siteSub">From {{ns:project}}<h3>
<div id="contentSub">Redirect page</div>
[[Image:Redirectltr.png]] <span class="redirectText">Help:Redirect</span>
</blockquote>


After the page title, the content of [[MediaWiki:Redirectpagesub]] (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 above, the text after the link to the redirect target is ignored, except for category tags.
After you create a redirect, you get sent to a page with the string "&redirect=no" in the URL. Thus the just created redirect page is shown, not the page to which it redirects. 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.


This does not apply in the {{ml|help:preview||preview}} of a redirect page: this ignores the special meaning of the redirect syntax, so it shows a one-item numbered list, with the link rendered as an ordinary link. Compare [http://meta.wikimedia.org/w/index.php?title=Babel&redirect=no] with the preview of its edit page [http://meta.wikimedia.org/w/index.php?title=Babel&action=edit].
When creating new redirects, bear in mind that creating too many redirects can clutter up the [[Help:Searching|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 [[Help:Piped link|piped link]] is another way to make a link to a page with a name which does not occur in the first page.


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.
A code like %70 in a redirect disables it, although the link works from the redirect page.


==Changing a redirect==
==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.
<div id="contentSub">(Redirected from [[Help:Redirection]])</div>


Click on a link to the redirect page. Then look for the "<code>(redirected from ''[[help:source page demo|source page]]'')</code>" link at the top of the page you've been redirected to. Click on the "source page" link. You will be taken to a page looking something like:
Once you get to the redirect page, click '''Edit this page'''. You can then either change the target of the redirect or replace the redirect with a brand new page.


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 above.
<blockquote style="background-color: white; color: black; border:1px solid black; padding: 1em;">
<b><big>Pagename</big></b><br/>
From ''project name'' ...<br/><br/>
<nowiki>#</nowiki>REDIRECT <nowiki>[[''target page'' ]]</nowiki>
</blockquote>


== Deleting a redirect ==
Then click '''Edit this page'''. You can then either change the target of the redirect or replace the redirect with a brand new page.
[[Meta:Administrators|Administrators]] can [[w:Wikipedia:Deletion policy|delete]] redirects in the same way as any other page. There may be project-specific guidelines on when this is appropriate.


== The moving function ==
Another way to do the same thing: 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 above.
When a page is renamed/moved with the [[Help:Moving a page|moving]] function, a redirect is automatically created from the old to the new name, and also one for the corresponding talk page.


If the new page name 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 must be moved by an administrator.
The redirect page shows the canonical form of the target, unlike its preview page, which renders the link in the usual way, compare [http://meta.wikimedia.org/w/index.php?title=Babel&redirect=no] with the preview of [http://meta.wikimedia.org/w/index.php?title=Babel&action=edit].


== Deleting a redirect ==

[[Meta:Administrators|Administrators]] can [[w:Wikipedia:Deletion policy|delete]] redirects in the same way as any other page. There may be project-specific guidelines on when this is appropriate.


== Interwiki redirects and redirects to special pages==
== Redirect to special targets ==
=== Interwiki redirects and redirects to special pages===


Interwiki redirects and redirects to special pages have been disabled, try e.g. [[Help:Interwiki redirect demo]] and [[Help:Redirect to special page demo]].
Interwiki redirects and redirects to special pages have been disabled, try e.g. [[Help:Interwiki redirect demo]] and [[Help:Redirect to special page demo]].


Use direct [[Help:Interwiki linking|interwiki link]]s (or direct links to Special pages) without redirect, or a soft redirect (non-automatic): a page with "See ...", e.g. [[w:Wikipedia:Enhanced Recent Changes]].
Use direct [[Help:Interwiki linking|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 ==
=== A redirect to an anchor ===
One can redirect to an anchor, in particular a section. [[Help:Section linking and redirects]] is an example and its target also provides more info.
One may redirect to an anchor, in particular a section. [[Help:Section linking and redirects]] is an example and its target also provides more info ('''it does not work for every environment''').


Section redirects work from r18220 onwards. See [[bugzilla:218]]. On older versions of MediaWiki, you will be redirected to <nowiki>[[definitions]]</nowiki> but you will not be sent to the #G anchor.
Section redirects are supposed to work from r18220 onwards. See [[bugzilla:218]]. If it does not work, you will be redirected to the page but you will not be sent to the section.


== A redirect to a page in the image or category namespace ==
=== 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 "Image", or "Category", respectively.
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 "Image", 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).
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).


==Images linking to a page==
===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 [[Help:Navigational image]].
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 [[Help:Navigational image]].


==Detecting links to redirects==
==Detecting links to redirects==

Specifying a very high value as threshold in the [[Help:Link#Stub_feature|stub feature]] allows indication of links having a redirect as target: while other links to the main namespace are all marked as stub, they are not (however, links to other namespaces look the same, they are also not marked as stub). This can be useful for clean-up work involving bypassing redirects.
Specifying a very high value as threshold in the [[Help:Link#Stub_feature|stub feature]] allows indication of links having a redirect as target: while other links to the main namespace are all marked as stub, they are not (however, links to other namespaces look the same, they are also not marked as stub). This can be useful for clean-up work involving bypassing redirects.


Line 123: Line 119:


==Redirect and/or link to non-existing page==
==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:
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:


#redirect B to A, 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)
#redirect B to A, 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)
#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)
#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)
#both (indirect self-link on A) - after applying the link from A through B back to A, use the link in the redirect message to go from A to B (for detecting a redirect see above; the method is useful for temporary use during clean-up, but not for permanent use; also, there is no distinction between a redirect back, and an onward redirect) (disadvantage, as far as not yet mentioned: not obvious for newbie)
#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 above; however, there is no distinction between a redirect back, and an onward redirect) (disadvantage, as far as not yet mentioned: not obvious for newbie)
#ditto but with a [[w:Wikipedia:soft redirect|soft redirect]] from B to A, i.e. a page only containing something like "See <nowiki>[[</nowiki>A]]"; one can see at A that B is very short using the [[Help:Link#Stub_feature|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)
#ditto but with a [[w:Wikipedia:soft redirect|soft redirect]] from B to A, i.e. a page only containing something like "See <nowiki>[[</nowiki>A]]"; one can see at A that B is very short using the [[Help:Link#Stub_feature|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)
#B is a redirect, link from A to B with "redirect=no", or link to B's edit page, e.g. [http://meta.wikimedia.org/w/index.php?title=Template&redirect=no Template] and [http://meta.wikimedia.org/w/wiki.phtml?title=Template&action=edit start page Template], respectively.
#B is a redirect, link from A to B with "redirect=no", or link to B's edit page, e.g. [http://meta.wikimedia.org/w/index.php?title=Template&redirect=no Template] and [http://meta.wikimedia.org/w/wiki.phtml?title=Template&action=edit start page Template], respectively.


In the 3rd and 4th case, 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.
In the 3rd and 4th case, 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.

==Rendering of the redirect page==

The redirect page shows the content of [[MediaWiki:Redirectpagesub]] (by default the text "Redirect page") with a bent arrow, followed by the link. This link shows the canonical form of the target.

This does not apply in the {{ml|help:preview||preview}} of a redirect page: this ignores the special meaning of the redirect syntax, so it shows a one-item numbered list, with the link rendered as an ordinary link. Compare [http://meta.wikimedia.org/w/index.php?title=Babel&redirect=no] with the preview of its edit page [http://meta.wikimedia.org/w/index.php?title=Babel&action=edit].


==Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)==
==Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)==
Line 145: Line 134:
(modified code by Uriah Anthony Stephenson-Ward | [mailto:uriah@diyinfo.org uriah@diyinfo.org] | [http://www.diyinfo.org DIYinfo.org])
(modified code by Uriah Anthony Stephenson-Ward | [mailto:uriah@diyinfo.org uriah@diyinfo.org] | [http://www.diyinfo.org DIYinfo.org])


;What?: This piece of code forces all redirects to be done by the client, by issuing them a 302 Temporary Redirect to the new pages specific location.

;Why?: A lot of search engines decrease your pages rank if they discover duplicated content. The traditional Redirect method allows a huge amount of duplication, and doesn't redirect as nicely. This also allows you to use images for navigation. Additionally it can be a limitation/annoying to not see the full redirected pages location in the address bar, and having the annoying "Redirected from" link.
'''What?''' This piece of code forces all redirects to be done by the client, by issuing them a 302 Temporary Redirect to the new pages specific location.
:'''Warning: This hack will increase your servers network load somewhat, for 99% of MediaWiki servers this will be negligible, but I wouldn't see Wikipedia doing this mod any time soon!'''

;How?: Open ''"includes\Article.php"'' and edit the function ''"followRedirect()"''

:Change line 94 (approximately) from ''"return $rt;"'' to ''"return $rt->getFullURL();"''
'''Why?''' A lot of search engines decrease your pages rank if they discover duplicated content. The traditional Redirect method allows a huge amount of duplication, and doesn't redirect as nicely. This also allows you to use images for navigation. Additionally it can be a limitation/annoying to not see the full redirected pages location in the address bar, and having the annoying "Redirected from" link.
:The whole function should now look like this:


'''''Warning'': This hack will increase your servers network load somewhat, for 99% of MediaWiki servers this will be negligible, but I wouldn't see Wikipedia doing this mod any time soon!'''


'''How?''' Open ''"includes\Article.php"'' and edit the function ''"followRedirect()"''

Change line 94 (approximately) from ''"return $rt;"'' to ''"return $rt->getFullURL();"''

The whole function should now look like this:
<pre>
<pre>
<nowiki>
<nowiki>
Line 204: Line 184:
</nowiki>
</nowiki>
</pre>
</pre>



==See also==
==See also==

*[[Help:Link#Stub_feature|Detecting links to redirects using the stub feature]].
*[[Help:Link#Stub_feature|Detecting links to redirects using the stub feature]].
*[[m:Redirects in search results - proposed software changes|Redirects in search results - proposed software changes]].
*[[m:Redirects in search results - proposed software changes|Redirects in search results - proposed software changes]].

Revision as of 14:57, 26 June 2007

See also: Wikipedia:Redirect

A redirect is a page with no content other than:

#REDIRECT [[pagename]]

Where pagename is the article or page to redirect to.

How it appears to the user

If the redirect target is an existing page in the same project, going to the redirect page by means of a link, the 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 below the top title to indicate you arrived here indirectly.

For example, if somebody goes to Help:Redirection, then they will end up at this page instead, and the top of the page will look like:

Help:Redirect

From Meta

(Redirected from Help:Redirection)

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 below).

Restrictions

As a simple way to avoid problems with infinite recursion, if the redirect target is another redirect page, the second redirect is not applied.

A redirect target cannot depend on a variable, template, or parser function. When attempting this, the restriction does not become apparent in the preview (see also the section below on the rendering of a redirect page), but only after saving.

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

Note also that different projects have different specifications on what can be redirected. On en.wiktionary.org, the multilingual dictionary, most redirects are prohibited by policy.

Purposes of a redirect

  • Allow access in the case that a pagename is provided:
    • which is an alternative term for the subject
    • which is a term 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 external links)

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, see Comparison with piped link.
  • 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.

Creating a redirect

If you're creating a new redirect, start a new page, write #REDIRECT [[pagename]] (or #redirect [[pagename]]) at the top of the page, where pagename is the name of the target page. Here is an example. If you're 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 #REDIRECT [[pagename]].

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 #REDIRECT command and link is ignored. It is rendered in preview only, see [1] and [2]. Category-tags are not ignored. If a category is set, the redirect-page is listed in the category it belongs to, see e.g. Template:Ddd. When following the link from the category page to the redirect page then as usual the redirect is applied.

An edit summary is automatically provided, with the text according to MediaWiki:Autoredircomment, 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 "&redirect=no" 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:

Help:Redirection

From Meta

Redirect page

Help:Redirect

After the page title, the content of MediaWiki:Redirectpagesub (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 above, the text after the link to the redirect target is ignored, except for category tags.

This does not apply in the preview of a redirect page: this ignores the special meaning of the redirect syntax, so it shows a one-item numbered list, with the link rendered as an ordinary link. Compare [3] with the preview of its edit page [4].

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.

(Redirected from Help:Redirection)

Once you get to the redirect page, click Edit this page. You can then either change the target of the redirect or replace the redirect with a brand new page.

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 above.

Deleting a redirect

Administrators can delete redirects in the same way as any other page. There may be project-specific guidelines on when this is appropriate.

The moving function

When a page is renamed/moved with the moving function, a redirect is automatically created from the old to the new name, and also one for the corresponding talk page.

If the new page name 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 must be 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. Help:Interwiki redirect demo and Help:Redirect to special page demo.

Use direct interwiki links (or direct links to Special pages) without redirect, or a soft redirect (non-automatic).

A redirect to an anchor

One may redirect to an anchor, in particular a section. Help:Section linking and redirects is an example and its target also provides more info (it does not work for every environment).

Section redirects are supposed to work from r18220 onwards. See bugzilla:218. If it does not work, you will be redirected to the page but you will not be sent to the 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 "Image", 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).

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 Help:Navigational image.

Detecting links to redirects

Specifying a very high value as threshold in the stub feature allows indication of links having a redirect as target: while other links to the main namespace are all marked as stub, they are not (however, links to other namespaces look the same, they are also not marked as stub). This can be useful for clean-up work involving bypassing redirects.

One may want to change the setting only temporarily, if one normally uses the stub feature in the regular way, and/or because section linking does not work on "stubs", unless external link style is used.

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:

  1. redirect B to A, 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. link A to B ("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)
  3. 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 above; 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 B to A, i.e. a page only containing something like "See [[A]]"; one can see at A that B 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. B is a redirect, link from A to B with "redirect=no", or link to B's edit page, e.g. Template and start page Template, respectively.

In the 3rd and 4th case, 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.

Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)

(for MediaWiki 1.9.0)

(modified code by Uriah Anthony Stephenson-Ward | uriah@diyinfo.org | DIYinfo.org)

What?
This piece of code forces all redirects to be done by the client, by issuing them a 302 Temporary Redirect to the new pages specific location.
Why?
A lot of search engines decrease your pages rank if they discover duplicated content. The traditional Redirect method allows a huge amount of duplication, and doesn't redirect as nicely. This also allows you to use images for navigation. Additionally it can be a limitation/annoying to not see the full redirected pages location in the address bar, and having the annoying "Redirected from" link.
Warning: This hack will increase your servers network load somewhat, for 99% of MediaWiki servers this will be negligible, but I wouldn't see Wikipedia doing this mod any time soon!
How?
Open "includes\Article.php" and edit the function "followRedirect()"
Change line 94 (approximately) from "return $rt;" to "return $rt->getFullURL();"
The whole function should now look like this:

	/**
	 * @return mixed false, Title of in-wiki target, or string with URL
	 */
	function followRedirect() {
		$text = $this->getContent();
		$rt = Title::newFromRedirect( $text );
		
		# process if title object is valid and not special:userlogout
		if( $rt ) {
			if( $rt->getInterwiki() != '' ) {
				if( $rt->isLocal() ) {
					// Offsite wikis need an HTTP redirect.
					//
					// This can be hard to reverse and may produce loops,
					// so they may be disabled in the site configuration.
					
					$source = $this->mTitle->getFullURL( 'redirect=no' );
					return $rt->getFullURL( 'rdfrom=' . urlencode( $source ) );
				}
			} else {
				if( $rt->getNamespace() == NS_SPECIAL ) {
					// Gotta handle redirects to special pages differently:
					// Fill the HTTP response "Location" header and ignore
					// the rest of the page we're on.
					//
					// This can be hard to reverse, so they may be disabled.
					
					if( $rt->isSpecial( 'Userlogout' ) ) {
						// rolleyes
					} else {
						return $rt->getFullURL();
					}
				}
				return $rt->getFullURL();
			}
		}
		
		// No or invalid redirect
		return false;
	}

See also

Links to other help pages

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
Versions of this help page (for other languages see further)
What links here on Meta or from Meta · Wikipedia · MediaWiki
Reading
Go · Search · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences
Editing
Starting a new page · Advanced editing · Editing FAQ · Export · Import · Shortcuts · Edit conflict · Page size
Referencing
Links · URL ·  · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · Lists · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Parameter default · Magic words · System message · Substitution · Array · Calculation · Transclusion
Others
Special characters · Renaming (moving) a page · Preparing a page for translation · Talk page · Signatures · Sandbox · Legal issues for editors