-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error page & enable multi-site redirect
- Loading branch information
Alvin Januar
committed
Feb 12, 2024
1 parent
fe5ac41
commit a648d53
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function handler(event) { | ||
var request = event.request; | ||
var uri = request.uri; | ||
|
||
// Check whether the URI is missing a file name. | ||
if (uri.endsWith("/")) { | ||
request.uri += "index.html"; | ||
} | ||
// Check whether the URI is missing a file extension. | ||
else if (!uri.includes(".")) { | ||
request.uri += "/index.html"; | ||
} | ||
|
||
return request; | ||
} |