Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ const useUrlParamsThenScrubUrl = ({ enabled }: UseUrlParamsThenScrubUrlParam): U

useEffect(() => {
if (enabled) {
// Fix for non-www redirect losing hash fragment
// If we're on opencerts.io (without www), redirect to www.opencerts.io with hash preserved
if (typeof window !== "undefined" && window.location.hostname === "opencerts.io") {
const newUrl = `https://www.opencerts.io${window.location.pathname}${window.location.search}${window.location.hash}`;
window.location.replace(newUrl);
return;
}

setUrlParams((currUrlParams) => {
// once the fragment is set, we never update it again
if (currUrlParams !== undefined) {
Expand Down