Index: trunk/extensions/Special404/Special404_body.php |
— | — | @@ -15,14 +15,20 @@ |
16 | 16 | global $wgOut, $wgRequest, $egSpecial404RedirectExistingRoots; |
17 | 17 | |
18 | 18 | if ( $egSpecial404RedirectExistingRoots ) { |
19 | | - $t = Title::newFromText($wgRequest->getRequestURL()); |
20 | | - if ( !is_object($t) || !$t->exists() ) { |
21 | | - $t = Title::newFromText(trim($wgRequest->getRequestURL(), '/\\')); |
| 19 | + $t = null; |
| 20 | + $titles = array( |
| 21 | + $wgRequest->getRequestURL(), |
| 22 | + trim($wgRequest->getRequestURL(), '/\\'), |
| 23 | + urldecode($wgRequest->getRequestURL()), |
| 24 | + urldecode(trim($wgRequest->getRequestURL(), '/\\')), |
| 25 | + ); |
| 26 | + foreach ( $titles as $pageTitle ) { |
| 27 | + $t = Title::newFromText($pageTitle); |
| 28 | + if ( is_object($t) && $t->exists() ) { |
| 29 | + $wgOut->redirect( $t->getFullURL(), 301 ); |
| 30 | + return; |
| 31 | + } |
22 | 32 | } |
23 | | - if ( is_object($t) && $t->exists() ) { |
24 | | - $wgOut->redirect( $t->getFullURL(), 301 ); |
25 | | - return; |
26 | | - } |
27 | 33 | } |
28 | 34 | |
29 | 35 | $this->setHeaders(); |