Help talk:Redirects

From mediawiki.org
Latest comment: 1 year ago by LMamo in topic Auto create redirecting pages

Discuss Help:Redirect page here:


Redirect stylesheets[edit]

I see there's special code that can be used to redirect .js pages, but there doesn't seem to be a way to redirect .css pages. We recently upgraded our Infobox's from HTML to Lua, so they now draw their styles from Module:Infobox/styles.css instead of Template:Infobox/styles.css. I'm concerned that it will lead to confusion and frustration in the future if users who are referencing Wikis with HTML infoboxes mistakenly think they can create a stylesheet in the Template namespace, which will have no effect on Infoboxes in our Wiki.

For now I think I'll just need to leave a comment in the Template namespace version with instructions to go to the Module version, and protect the page from edits, but ideally I'd prefer anyone who navigates to that URL to just be redirected to the correct page in the Module namespace automatically.

Dynamic Redirect Using a Template[edit]

I would like to do the following:

#REDIRECT [[{{:PageWithTarget}}]]

This can be useful in many situations ie you can have one page that has only the text name of the US president, lets call that page PUSA, and then the article "United States" can reference that page and also the page "President Of The United States" would redirect automatically using: #REDIRECT [[{{:PUSA}}]]

This doesn't work for me currently on mediawiki 13.

--80.179.206.193 15:06, 24 June 2009 (UTC)Reply

Template variables[edit]

The following is also not possible, which is a shame. So you cannot move redirects or documentation to a new version. #REDIRECT [[{{{1}}}:Something]] where {{{1}}} = Version4

217.149.140.2 13:13, 4 October 2010 (UTC)Reply

Redirect to an external website[edit]

How do you redirect to an external website ?

I would love to be able to make an image clickable to an external website.

--83.209.82.108 - 11:44, 24 December 2007

I don't think this question really relates to redirecting. You want to link , to an external website, and you want to create a click-able image. See Help:Links. You can't easily make an image clickable, though is it possible using rather ugly Template:Click tricks. A straightforward text link appearing below an image, is more easily do-able with normal wiki text.
If you are interested in redirecting to external websites. Well you can't do that either. It's not really the kind of thing the wiki syntax is designed to let you do. Part of the reason might be that it would be too easy to abuse.
-- Harry Wood 14:55, 24 December 2007 (UTC)Reply

Only if your Wiki is in Intranet use and you are NOT worried about security:

<html><a id="redirectme" href="http://&namespace=">alfa</a></html>

<html>
<script type="text/javascript">
document.location.href=document.getElementById('redirectme').href
</script>
</html>

--Analienholakres3 12:19, 22 December 2008 (UTC)Reply

interwiki example[edit]

Example with MySQL to enable a redirect to a forum, using interwiki:

INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans) VALUES ("helpforum", "http://www.mysite.com/forum/", 1, 0);

Then you can put the redirect tag in the Help page in the sidebar:

#REDIRECT [[helpforum:]]

redirect seems to work if it's the first thing on a page[edit]

we can store other information below the redirect line, and only see it when clicking on the back link from the redirected target page peblusto 11:41, 28 December 2007 (UTC)Reply


Viewing a redirect[edit]

i propose the following rewording for this section Help:Redirects#Viewing_a_redirect peblusto 11:41, 28 December 2007 (UTC):Reply

After creating a redirect, the wiki automatically redirects a browser to the target page. However there is a link displayed near the top of the target page. Click this to go to the redirecting page. On the redirecting page, you can do all the things that any other wiki page allows. You can go to the associated discussion page to discuss the redirect. You can view the history of the page before the redirect was put in place. You can edit and change the redirect, and you can revert to an older version to remove the redirect.


How I can redirect the page to an external page?[edit]

This comment not same as the 1st comment about, what I needs is when a user click on the About at the footer, it will open the About page, then redirect to my existing about in an other site. And also many other link content is existed in my other sites.

I know I can do it by editing the script code, but I would like to let it as is and using redirect for this purpose, so anytime I want to change the location of content, I just needs to change the redirect, no needs to go to the script code, edit and upload it again.

Regards,

117.5.159.152 02:26, 26 February 2008 (UTC)Reply

Redirecting images[edit]

Hi! We were redirecting some images (icons) to articles, but it seems the behaviour changed in the current version; the redirects are just shown now and not applied. Bug or feature? For us it was very nice to be able to redirect images. Hum. 79.193.235.2 21:39, 12 May 2008 (UTC)Reply

Yes, the same thing has happened to me. My whole wiki is based on redirected images and now they don't work! What to do?: See http://www.queenstown.net.nz/index.php?title=Activities for example. --203.118.172.243 02:23, 13 May 2010 (UTC)Reply
Since version 1.13, the redirection of image pages is really messy... I need to hack the code to make it work.
In "includes/Wiki.php" (line ~313 in 1.16a2), you have to change this part :
		// Namespace might change when using redirects
		// Check for redirects ...
		$file = ($title->getNamespace() == NS_FILE) ? $article->getFile() : null;
		if( ( $action == 'view' || $action == 'render' ) 	// ... for actions that show content
			&& !$request->getVal( 'oldid' ) &&    // ... and are not old revisions
			$request->getVal( 'redirect' ) != 'no' &&	// ... unless explicitly told not to
			// ... and the article is not a non-redirect image page with associated file
			!( is_object( $file ) && $file->exists() && !$file->getRedirected() ) )
		{

to :

		// Namespace might change when using redirects
		// Check for redirects ...
		$file = ($title->getNamespace() == NS_FILE) ? $article->getFile() : null;
		if( ( $action == 'view' || $action == 'render' ) 	// ... for actions that show content
			&& !$request->getVal( 'oldid' ) &&    // ... and are not old revisions
			$request->getVal( 'redirect' ) != 'no' )
		{

--77.197.127.63 23:54, 29 May 2010 (UTC)Reply

Many thanks, that worked beautifully. --203.109.209.190 03:30, 9 June 2010 (UTC)Reply

Redirection import[edit]

When we use the mass import special page, if the content of a page is a redirection, it isn't considered this way (just as plain text): to be "recognized", you have to edit and save each page manually (no need to change its content).

It is the same when we try to save afterwards the page with some test extensions to bypass this problem (for exemple using doEdit method of class Article).

Has anyone found a way either to import redirection pages (and have them directly recognized) or knows how to save a page in a extension so that it is recognized as a redirection page ?

Thanks by advance for any idea :)

-- Gizmhail 15:58, 6 August 2008 (UTC)Reply

Table of external redirects[edit]

For ease of maintenance of external links, I would like to create a table / list / page of external URLs and then be able to refer to these web sites by local name. This could possibly be done with a complex template. Anything simpler that could be organised? Something similar to interwiki maps?

--Ironfrown 11:45, 14 September 2008 (UTC)Reply

An interwiki link works fine for this. So does a simple template. —Emufarmers(T|C) 21:03, 14 September 2008 (UTC)Reply

Redirecting to a version (especially a flagged, reviewed revision) of a page[edit]

I believe versions cannot be addressed in wiki syntax (only through URLs, which makes internal pages equivalent to external links). Thus a redirect to a specific version is most likely not possible. Can the normal wiki page link syntax be somehow extended to deal with versions? Where would be a good place to discuss this? --G.Hagedorn 10:04, 3 June 2009 (UTC)Reply

This would also make possible to give names to old versions of a page (kind of a baseline). --Cybermandrake (talk) 17:55, 9 July 2014 (UTC)Reply

Redirect from File namespace problem[edit]

I am trying to redirect from a file namespace - on many mediawiki installations this is possible, but on the current one, I am running into blocks that I can't figure out, can someone direct me? Best, MarkDilley

Upgrade MediaWiki. —Emufarmers(T|C) 17:21, 23 November 2009 (UTC)Reply

Listing all redirects in a wiki[edit]

Hi to all! Does somebody know a way to show/list all redirects that exist in a wiki? I know there is the special page Special:ListRedirects, but it is limited to 1000 pages. If it is not possible, is there a way to find them (maybe via the logfile) by using the pywikipedia bot? Thanks a lot! --Plasmarelais 16:07, 30 May 2010 (UTC)Reply

This is also discussed here wikipedia:Wikipedia_talk:Special:ListRedirects#Removal_of_redirects. --John Ericson 23:20, 8 April 2011 (UTC)Reply

Redirect Template[edit]

Is it possible to construct a template, that redirects to another page when the template is the only content of the supposed redirect page? For example I edit the page Stefani Germanotta so it only contains the text "{{Alternative Name|Lady Gaga}}". The template {{Alternative Name|XXX}} is supposed to create the redirect to XXX itself without having to put it there manually (while also doing other things like inserting categories, but that I already managed to do). Note: This only an example, I'd like to have this for my Wiki not for Wikipedia. Any help is appreciated. --Theaitetos 22:09, 16 December 2010 (UTC)

Another example: in my own wiki I am creating redirects for alternate terms. E.g. "DMT" and "DMT (Dynamic Multithreading)". I would like to mark all of these redirects with the appropriate categories, e.g. "Term" and "Acronym", and have them all redirect to the standard place (on my wiki, currently "Dynamic Multithreading (DMT)". --Andy Glew, 2012/3/14.

    Actually, I would like to have a template create all of these alternate pages / redirect links. But that seems to be beyond mediawiki's ability - it is one reason I am considering switching back to twiki or foswiki.

NeatNit (talk) 17:12, 17 April 2016 (UTC):Reply

I am very late for you guys but if anyone else finds this useful, here's how I made mine (full template page here):
 Usage: make this the ONLY text in a page, for example in [[DPanel]]:
 
 '''(nowiki){{subst:ToCategory}}(/nowiki)''' (the (nowiki) tags here are angle-bracketed of course, but it messed with putting this here in this talk page)
 
 This will create a redirect page to the category of the same name. In the DPanel example, it will redirect to [[:Category:DPanel]].
 
 <includeonly><onlyinclude>#REDIRECT [[:Category:{{subst:PAGENAME}}]]</onlyinclude></includeonly>
I hope this is useful to someone :)
--NeatNit (talk) 17:12, 17 April 2016 (UTC)Reply

Redirecting with Variables[edit]

I'm trying to redirect to a page titled June_2011_Blah (whether or not it exists). I create a page called Current_Month, link to it and put this as the redirect: #redirect [[{{CURRENTMONTHNAME}}_{{CURRENTYEAR}}_Blah]] but that leaves only the list item that needs to be clicked on. The plan is to have this link always pointing to this month's entry and to change automagically switch to the next month when we roll over to July, etc... Any thoughts?

I like the idea, but i am not sure it is currently possible. Bud0011 20:24, 4 June 2011 (UTC).Reply
Any update on this idea? I'm trying to do something similar with:
                 #REDIRECT [[User_talk:Technical_13/{{#time:Y|now -5 hours}}/{{#expr:ceil({{#time:n|now -5 hours}}/3)}}]]
This gives me:
                 #REDIRECT User_talk:Technical_13/2024/2
Not a redirect... Is redirect part of the wiki-code itself, or is it an extension? Maybe I could figure a way to edit the code or even build an extension? ~-~ Technical 13 23:46, 31 December 2011 (UTC)Reply
You have to subst: any templates/magic words/variables for it to work. So no. --NeatNit (talk) 17:14, 17 April 2016 (UTC)Reply
m:Help:Redirect#Restrictions.Jonteemil (talk) 01:48, 3 April 2020 (UTC)Reply

Allowing multiple redirects[edit]

This seems to work: it was apparently introduced in v1.15.0 :

Manual:$wgMaxRedirects

Sometimes using multiple redirects seem to be appropriate: I've just been working on a wiki where we have two distinctly different types of redirect that need to be stacked, and setting the value of this variable to "2" solved the problem. ErkDemon 19:20, 12 July 2011 (UTC)Reply

Interesting idea.....Anyway, i have added it to the help article page. Thanks for the info. Bud0011 19:56, 14 July 2011 (UTC).Reply

Deleting a redirect[edit]

It appears to me that the explanations under deleting a redirect are either wrong or (at least) misleading. It says: "If you need to delete a redirect, you simply go to the redirect page as mentioned above, and follow the procedures at Help:Deleting a page."

To clarify my point, let me give an example. Let's say you moved "Main Page" to something like "My Wiki", "Main Page" becomes the so called redirect-page with only one line:

#REDIRECT [[''My Wiki'']]

If you delete this page you are left with the page "My Wiki", but the original "Main Page" is gone. As a result you do not get your "Main Page" back, but lose it permanently. You can edit the page, remove the "redirect" and copy the text from "My Wiki" to "Main Page". Subsequently you could delete the page "My Wiki", but you would lose the history of the page that once was called "Main Page". The "Main Page" will be considered to be a newly created page, with a new history. I have also tried to undo the edits of the "new" page "My Wiki" to a state when it was still called "Main Page", but was not allowed to do that (because of edits in between) and/or even if editing an "old" version the name would still be "My Wiki". Question(s):

  1. Is there any way to revert the redirect?
  2. Is the only solution to have two pages with the same content or to get the "old" page back, but its history being deleted?
  3. Can an edit of old versions rescue the name of the "old" page?--Ob.helm 13:54, 12 February 2012 (UTC)Reply
You seem to mean undoing a page move. See Help:Moving a page#Undo a move. If needed you can first delete the redirect.--Patrick1 22:35, 13 February 2012 (UTC)Reply
Thanks, that did the "trick"--Ob.helm 08:32, 14 February 2012 (UTC)Reply

Getting the pagename of the redirect target[edit]

Is there anyway for me to grab the name of the redirect target from another page? Essentially, if page 'Foo' redirect to the page 'Bar', using a function like {{PAGENAME:Foo}} would result in 'Bar'. Eladkse (talk) 08:47, 2 May 2012 (UTC)Reply

Yes, if you have some way of taking substrings, create a template say {{Redirect target }} - and call it thus {{Redirect target|{{Foo }}}}.
If your redirects are all perfectly formed you just have to strip off the first 12 and the last 2 characters. If not you need to match the [[...]]. And of course you can get smart and throw an error if it doesn't start with #Redirect, etc. etc. Rich Farmbrough 23:03, 9 May 2014 (UTC).Reply

How to Redirect My Talk Page (ID)?[edit]

Hi, I'm from Indonesia. How to redirect my Talk page (en) to my Talk page (id)? Can bot write on my talk page (id) automatically?Akateljkt (talk) 06:20, 25 November 2014 (UTC)Reply

wrong redirect by using mobile devices[edit]

my mediawiki page (ticopedia.de) will be redirected to a wrong target (deticopedia.de) if you use a mobile device, f.e. iPhone How can I fix the problem, so that there is no redirect to another page, and the page will displayed right. --Picaflor74 (talk) 08:09, 29 July 2015 (UTC)Reply

thanks in advance

Should redirects set <link rel="canonical" ... > differently?[edit]

I noticed something -- if I understand correctly, redirect pages are telling search engines that they themselves are the canonical page, rather than their targets. For instance,

meta:Help:Redirection is a page that redirects to meta:Help:Redirect. The redirect page itself includes the following HTML:

<link rel="canonical" href="https://meta.wikimedia.org/wiki/Help:Redirection"/>

Shouldn't that instead read lik the following:

<link rel="canonical" href="https://meta.wikimedia.org/wiki/Help:Redirect"/>

...in order to advise search engine spiders that Help:Redirect is where the authoritative info lives?

For what it's worth, this question on Quora is what got me thinking about this, and my (admittedly limited) understanding of canonical links derives from this page on Medium.

Thoughts? -Pete Forsyth (talk) 18:41, 13 January 2017 (UTC)Reply

Update
I created this bug tracking ticket": task T155266 -Pete Forsyth (talk) 20:40, 13 January 2017 (UTC)Reply

Disable improved redirect[edit]

How I disable the URL rewriting after entering a redirect? GXXFT·C 17:44, 31 May 2017 (UTC)Reply

What does a redirect do in pratice?[edit]

I'm confused. I've checked the HTTP response headers of a redirecting page, and with surprise I've seen that the user is never redirected to the correct URL of a page: the user never receives any HTTP 3** header and he only receives a w:canonical link element. Disabling JavaScript you can note that, visiting a redirect e.g. w:it:Aquila reale, the user remains on https://it.wikipedia.org/wiki/Aquila_reale. Only with JavaScript enabled you can see that the URL changes to the canonical one. What does a redirect do in practice? --Valerio Bozzolan (talk) 17:11, 20 January 2018 (UTC)Reply

Dynamic page[edit]

hi i should create a duynamic page, if you get to the page directly the page redirect you to another, if you include the page this show the text
<noinclude>#REDIRECT [[page#Title]]</noinclude>
<includeonly>
===Title===
text </includeonly>
but if i put the #REDIRECT within the noinclude it not work, how i can suppress it to included page?
--Selven (talk) 01:26, 28 February 2018 (UTC)Reply

Hiding redirects in search results[edit]

Is there a way to hide redirects in search results by default so it only displays non-redirect pages? I can't find anything about this. 日本穣 Nihonjoe (talk) 17:59, 16 March 2018 (UTC)Reply

I, too, would welcome this ability. Seeing redirects in search results is a recipe for confusing new users, and confused users don't use wikis. 69.203.102.97 18:15, 4 September 2018 (UTC)Reply

I second this. However, this should be asked at the support desk. --Cuatro Remos (talk) 06:06, 1 June 2019 (UTC)Reply

Detecting redirection[edit]

Is there any way to detect that one has loaded a page through a redirection? I'd like a page to display some extra stuff if it has been reached (or transcluded) using a redirection. Urhixidur (talk) 16:10, 26 February 2020 (UTC)Reply

Is it possible to redirect all the contents from one category to another?[edit]

Let's assume there are two categories, one called cetagory:a and another called category:b.

Category:a has two articles, namely Main_Page and article_a.

Category:b has one article, namely article_b.


If I redirect category:b to category:a, will category:a inherit the content from category:b?

Would category:a have Main_Page, article_a and article_b?

MarioSuperstar77 (talk) 23:28, 19 July 2020 (UTC)Reply

#Redirect, #REDIRECT, or other case format preferred?[edit]

Hi all. I find #Redirect [[Target article]] quite a bit easier on the eyes than #REDIRECT [[Target article]]. Anyone opposed to changing the example given at Help:Redirects#Creating_a_redirect to use that format? Cheers, Facts707 (talk) 03:28, 11 August 2021 (UTC)Reply

Auto create redirecting pages[edit]

Hello. I was wondering if anyone knew a way to automatically create redirection pages from a list of synonyms. For instance, if my wiki had a "Poney" page and I registered "Shettland Poney" as a synonym, could I make it so the page "Shettland Poney" is created automatically and points to the "Poney" one?

Thanks in advance for tour help.

AardvarkusMaximus (talk) 13:23, 3 August 2022 (UTC)Reply

Just to be a bit clearer, I display this information in my pages as known synonyms:
{{#arraymap:{{{synonym|}}}|,|x|[[synonym::x]]}}
and want every iteration to be a page redirecting to this one. AardvarkusMaximus (talk) 13:44, 3 August 2022 (UTC)Reply
One way of doing this could be using the #autoedit function from the PageForm extension. It could allow the creation of a page through a simple click. LMamo (talk) 13:48, 18 August 2022 (UTC)Reply