Extension talk:UrlShortener
Add topicAppearance
Latest comment: 5 months ago by Arcstur in topic Error when dot is in URL
[SOLVED] MW 1.43 compatibility
[edit]Can anyone confirm? Thanks. Jonathan3 (talk) 22:18, 4 December 2025 (UTC)
- Looks like the master branch's extension.json requires MW 1.46!
- I guess if I download the REL1_43 branch for MW1.43 it will work :-) Jonathan3 (talk) 22:42, 4 December 2025 (UTC)
- It did. Jonathan3 (talk) 14:38, 9 January 2026 (UTC)
"You can also use this alternative URL:"
[edit]This alternative has an underscore, e.g. domain.com/_xyz. The text is "urlshortener-shortened-url-alt".
Why does it offer this alternative URL, and how can I get it to stop doing this? Thanks. Jonathan3 (talk) 14:39, 9 January 2026 (UTC)
- It shows the alternative because the canonical may contain certain characters that are not easily linkable (reserved characters, etc).
- You cannot turn it off, but you can ignore it. – Ammarpad (talk) 09:06, 18 January 2026 (UTC)
- That's odd. I thought that's what $wgUrlShortenerIdSet was for.
- GOOD NEWS THOUGH! There is a happy medium between turning it off and ignoring it - it doesn't appear at all if you just blank MediaWiki:Urlshortener-shortened-url-alt.
- Presumably it still creates the alternative URL but nobody needs to know about that. Jonathan3 (talk) 14:49, 18 January 2026 (UTC)
- I thought the alt URL always contained Special:UrlRedirector, as a safer fallback or something. But that's not the case. What is the alternative URL for? The docs don't say anything. Sam Wilson 02:58, 19 January 2026 (UTC)
- It just takes the same format of
short.url/charactersbut instead is like this:short.url/_characters. And the characters are different, so it might be short.url/G and short.url/_c Jonathan3 (talk) 10:37, 19 January 2026 (UTC) - Consider the short code
G3E$and its alt form_mzo2. - If you’re logged in to X and go to https://x.com/compose/post?text=https://w.wiki/G3E$, you’ll see that only
https://w.wiki/G3Eis linked, the$is dropped. - That breaks the canonical shortcode
G3E$, and will generally (mis)lead you to a different destination or a 404. - The alternative form does not have this problem: https://x.com/compose/post?text=https://w.wiki/_mzo2 – Ammarpad (talk) 14:31, 19 January 2026 (UTC)
- I was going to ask why on earth anyone would include the $ character within $wgUrlShortenerIdSet, but then noticed that it's common enough (see https://github.com/search?q=wgUrlShortenerIdSet&type=code) and that it's in the example at Extension:UrlShortener.
- Was the alternative URL introduced to deal with the problem caused by the $ character in $wgUrlShortenerIdSet on those websites?
- If so, then maybe that should be documented so that other people could be told that it's OK to blank the relevant message page to avoid confusion. Jonathan3 (talk) 14:44, 19 January 2026 (UTC)
- Yes.
- If you're setting up UrlShortner extension for the first time today, you can avoid the problem by removing the character(s) in $wgUrlShortenerIdSet. – Ammarpad (talk) 19:23, 19 January 2026 (UTC)
- I was going to edit the content page to reflect your answer, but had a further look and it seems that the real reason was to have an alternative to "bad words" (T230685: "Provide an alternate mapping for bad words"), though I can see that it has the effect you describe. Jonathan3 (talk) 22:33, 19 January 2026 (UTC)
- @Ammarpad @Samwilson I made a couple of changes to the content page, but feel free to improve on them! https://www.mediawiki.org/w/index.php?title=Extension%3AUrlShortener&diff=8161635&oldid=8087389 Jonathan3 (talk) 23:00, 19 January 2026 (UTC)
- @Ammarpad and Jonathan3: Those updates look good! Thanks. And so is the rationale here that the alt is unlikely to generate a bad word at the same time that the main one does? And yeah, good point about dollar sign — I've added a note to the docs saying that it might be good to remove it at set-up time. Sam Wilson 00:56, 20 January 2026 (UTC)
- @Ammarpad @Samwilson I made a couple of changes to the content page, but feel free to improve on them! https://www.mediawiki.org/w/index.php?title=Extension%3AUrlShortener&diff=8161635&oldid=8087389 Jonathan3 (talk) 23:00, 19 January 2026 (UTC)
- I was going to edit the content page to reflect your answer, but had a further look and it seems that the real reason was to have an alternative to "bad words" (T230685: "Provide an alternate mapping for bad words"), though I can see that it has the effect you describe. Jonathan3 (talk) 22:33, 19 January 2026 (UTC)
- It just takes the same format of
Error when dot is in URL
[edit]It seems when the URL has a dot, instead of showing "short URL not found", it gives an error: w.wiki/a., like in this one. Arcstur (talk) 11:48, 2 February 2026 (UTC)