Skip to content

Commit

Permalink
Merge pull request #64 from petershafer/main
Browse files Browse the repository at this point in the history
Bugfix for trailing slash redirects when using pathPrefix option.
  • Loading branch information
zachleat authored Apr 19, 2024
2 parents 50749c4 + 1625f0a commit 610a4f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ class EleventyDevServer {
if (indexHtmlExists && !url.endsWith("/")) {
return {
statusCode: 301,
url: url + "/",
url: u.pathname + "/",
};
}

// /resource/ => redirect to /resource
if (htmlExists && url.endsWith("/")) {
return {
statusCode: 301,
url: url.substring(0, url.length - 1),
url: u.pathname.substring(0, u.pathname.length - 1),
};
}

Expand Down

0 comments on commit 610a4f7

Please sign in to comment.