Skip to content

Commit

Permalink
Bugfix for trailing slash redirects when using pathPrefix option.
Browse files Browse the repository at this point in the history
  • Loading branch information
petershafer committed Jul 25, 2023
1 parent 8665cce commit 1625f0a
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 @@ -280,15 +280,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 1625f0a

Please sign in to comment.