follow-up r59522 and r59735. only redirect to a variant URL when logged out.
This commit is contained in:
parent
fd042bfebd
commit
13d7d9936a
1 changed files with 6 additions and 2 deletions
|
|
@ -212,8 +212,12 @@ class MediaWiki {
|
||||||
( !isset($this->GET['variant']) && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) ) &&
|
( !isset($this->GET['variant']) && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) ) &&
|
||||||
!count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )
|
!count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )
|
||||||
{
|
{
|
||||||
$pref = $wgContLang->getPreferredVariant( $fromUser = false, $fromHeader = true );
|
if( !$wgUser->isLoggedIn() ) {
|
||||||
$targetUrl = $title->getFullURL( $variant = $pref );
|
$pref = $wgContLang->getPreferredVariant( false, $fromHeader = true );
|
||||||
|
$targetUrl = $title->getFullURL( '', $variant = $pref );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$targetUrl = $title->getFullURL();
|
||||||
// Redirect to canonical url, make it a 301 to allow caching
|
// Redirect to canonical url, make it a 301 to allow caching
|
||||||
if( $targetUrl == $request->getFullRequestURL() ) {
|
if( $targetUrl == $request->getFullRequestURL() ) {
|
||||||
$message = "Redirect loop detected!\n\n" .
|
$message = "Redirect loop detected!\n\n" .
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue