**Feature summary**
`$wgDisableHardRedirects` prevents two types of redirects from being “hard redirects,” and turns them into “soft redirects,” which require another click:
# Interwiki redirects to other wikis
# Redirects to special pages
These are two different things. It's quite possible a wiki wishes to allow one, but not the other. Shortcuts to special pages such as [[SP:RC]] can be very useful. I don't really understand why they're not allowed. Redirects to certain problematic pages like [[Special:LogOut]] are prohibited, regardless.
{T326054} would be straightforward to fix.
I can understand why interwiki redirects would be stopped. Someone viewing an independent 3rd party wiki doesn't expect to be whisked off to Wikipedia after clicking a blue link.
This is quite an old setting (from 2006), IMIIC, and has worked for 20 years, but might need a rethink.
**Proposal**
This configuration should be split into two different configurations, or at least one of them split off into something like:
- `$wgDisableHardRedirectsToSpecialPages`
- `$wgDisableHardInterWikiRedirects`
Needs discussion.
** Notes **
`DisableHardRedirects` occurs 7 times in code ([[ https://codesearch.wmcloud.org/search/?q=DisableHardRedirects&files=&excludeFiles=&repos= | Code search]])
# Core: `docs/config-vars.php`
# ` docs/config-schema.yaml`
# `includes/MainConfigSchema.php`
# `includes/actions/ActionEntryPoint.php`
# `includes/config-schema.php`
plus:
- `labs/countervandalism/cvn-infrastructure`
- `operations/mediawiki-config`
The last two have something to do with specifically excluding https://www.donatewiki.org so the WMF can hoover in those juicy, juicy donations. They're external interwiki links.
**1. docs/config-schema.yaml**
link: https://gerrit.wikimedia.org/g/mediawiki/core/+/f2cdaa7664631765b183476ae8004d36f72b94cf/docs/config-schema.yaml
This defines the variable as follows:
```lang=php
DisableHardRedirects:
default: false
description: |-
Disable redirects to special pages and interwiki redirects, which use a 302
and have no "redirected from" link.
@note This is only for articles with #REDIRECT in them. URL's containing a
local interwiki prefix (or a non-canonical special page name) are still hard
redirected regardless of this setting.
```
**2. docs/config-vars.php**
```lang=php
/**
* Config variable stub for the DisableHardRedirects setting, for use by phpdoc and IDEs.
* @see MediaWiki\MainConfigSchema::DisableHardRedirects
*/
$wgDisableHardRedirects = null;
/**
```
3. includes/MainConfigNames.php
https://gerrit.wikimedia.org/g/mediawiki/core/+/f2cdaa7664631765b183476ae8004d36f72b94cf/includes/MainConfigNames.php
lines:
```lang=php
/**
* Name constant for the DisableHardRedirects setting, for use with Config::get()
* @see MainConfigSchema::DisableHardRedirects
*/
public const DisableHardRedirects = 'DisableHardRedirects';
```
5. includes/MainConfigSchema.php
https://gerrit.wikimedia.org/g/mediawiki/core/+/f2cdaa7664631765b183476ae8004d36f72b94cf/includes/MainConfigSchema.php
```lang=php
/**
* Disable redirects to special pages and interwiki redirects, which use a 302
* and have no "redirected from" link.
*
* @note This is only for articles with #REDIRECT in them. URL's containing a
* local interwiki prefix (or a non-canonical special page name) are still hard
* redirected regardless of this setting.
*/
public const DisableHardRedirects = [
'default' => false,
];
```
6. includes/actions/ActionEntryPoint.php
https://gerrit.wikimedia.org/g/mediawiki/core/+/f2cdaa7664631765b183476ae8004d36f72b94cf/includes/actions/ActionEntryPoint.php
```lang=php
// Follow redirects only for... redirects.
// If $target is set, then a hook wanted to redirect.
if ( !$ignoreRedirect && ( $target || $page->isRedirect() ) ) {
// Is the target already set by an extension?
$target = $target ?: $page->followRedirect();
if ( is_string( $target ) && !$this->getConfig( MainConfigNames::DisableHardRedirects ) ) {
// we'll need to redirect
return $target;
}
```
7. includes/config-schema.php
https://gerrit.wikimedia.org/g/mediawiki/core/+/f2cdaa7664631765b183476ae8004d36f72b94cf/includes/config-schema.php
Just says:
```lang=php
'DisableHardRedirects' => false,
```
(6) appears to be the critical one here., in particular, is `&$ignoreRedirect` which is a boolean value that occurs several times in code: [[ https://codesearch.wmcloud.org/search/?q=ignoreRedirect+&files=&excludeFiles=&repos=&i=fosho | code search ]].