Skip to content

Commit 599828d

Browse files
committed
Update _redirects to use git-pages format
Ended up being a minimal change! Like Cloudflare Pages, git-pages doesn't normalize the URL path. Unlike Cloudflare Pages, you can't shadow an existing directory implicitly, so this file now needs `!` after each status to give it precedence
1 parent aa6dea9 commit 599828d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/pages/_redirects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// This file is used for redirects in Cloudflare Pages:
2-
// https://developers.cloudflare.com/pages/configuration/redirects/
1+
// This file generates Netlify-style redirects for git-pages:
2+
// https://codeberg.org/git-pages/git-pages
33
//
44
// NOTE: This file doesn't normally get included by Astro because it starts
55
// with an underscore, but there's a small custom integration in the Astro
@@ -44,8 +44,8 @@ export async function GET() {
4444
// a trailing slash
4545
const redirectList = redirects
4646
.flatMap(({ from, to, code = 301 }) => [
47-
`${from} ${to} ${code}`,
48-
`${from}/ ${to} ${code}`,
47+
`${from} ${to} ${code}!`,
48+
`${from}/ ${to} ${code}!`,
4949
])
5050
.join("\n");
5151
return new Response(`${redirectList}\n`);

0 commit comments

Comments
 (0)