Skip to content

Commit 9c765ab

Browse files
authored
Merge pull request #41014 from github/repo-sync
Repo sync
2 parents 548780a + 0bfa26d commit 9c765ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/redirects/lib/permalinks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ export default function permalinkRedirects(
3333
}
3434

3535
// Exceptions where the `redirect_from` entries are too old
36+
// Only replace /enterprise/ when it's at the start of the path followed by /admin/
37+
// This handles legacy patterns like /enterprise/admin/... → /admin/...
38+
// but preserves paths like /early-access/enterprise/... where enterprise is a directory name
3639
frontmatterOldPath = frontmatterOldPath
3740
.replace('/admin/guides/', '/admin/')
38-
.replace('/enterprise/', '/')
41+
.replace(/^\/enterprise\/admin\//, '/admin/')
3942

4043
permalinks.forEach((permalink, index) => {
4144
// For the first supported permalink (the order is determined by lib/all-versions),

0 commit comments

Comments
 (0)