Skip to content

Commit

Permalink
Additional redirects for mongodb set-to-book conversion (#1103)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola authored Oct 25, 2024
1 parent 5cd64ef commit 08cc46b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,14 @@
'regexp.reference' => 'regexp.introduction',
"security" => "manual/security",

// Set to book
// MongoDB converted from set to book
'set.mongodb' => 'book.mongodb',
'mongodb.installation.homebrew' => 'mongodb.installation#mongodb.installation.homebrew',
'mongodb.installation.manual' => 'mongodb.installation#mongodb.installation.manual',
'mongodb.installation.pecl' => 'mongodb.installation#mongodb.installation.pecl',
'mongodb.installation.windows' => 'mongodb.installation#mongodb.installation.windows',
'mongodb.persistence.deserialization' => 'mongodb.persistence#mongodb.persistence.deserialization',
'mongodb.persistence.serialization' => 'mongodb.persistence#mongodb.persistence.serialization',
];

if (isset($manual_page_moves[$URI])) {
Expand All @@ -262,7 +268,13 @@
} elseif (preg_match("!^manual/([^/]+)/([^/]+).php$!", $URI, $match) &&
isset($manual_page_moves[$match[2]])) {
status_header(301);
mirror_redirect("/manual/$match[1]/" . $manual_page_moves[$match[2]] . ".php");

$parts = explode('#', $manual_page_moves[$match[2]], 2);
if (count($parts) === 1) {
mirror_redirect("/manual/{$match[1]}/{$parts[0]}.php");
} else {
mirror_redirect("/manual/{$match[1]}/{$parts[0]}.php#{$parts[1]}");
}
}

$manual_redirections = [
Expand Down

0 comments on commit 08cc46b

Please sign in to comment.