Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ function = "redirect-from-old-portal"
path = "/:locale/announcements/*--*"
function = "redirect-from-old-portal"

# Catch-all to handle hostname redirects for all paths
[[edge_functions]]
path = "/*"
function = "redirect-from-old-portal"

[[redirects]]
force = true
from = "/:locale/docs/tutorials/creating-multi-store-multi-domain"
status = 308
to = "/docs/tutorials/managing-a-multistore"
to = "/docs/tutorials/managing-a-multistore"
15 changes: 15 additions & 0 deletions netlify/edge-functions/redirect-from-old-portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ export default async (request, context) => {
console.log('request.url', request.url)

const url = new URL(request.url)

// Redirect from old hostname to new hostname
if (url.hostname === 'newhelp.vtex.com') {
const newUrl = new URL(request.url)
newUrl.hostname = 'help.vtex.com'
return new Response(null, {
status: 308,
headers: {
Location: newUrl.toString(),
'Cache-Control':
'public, max-age=3600, s-maxage=3600, stale-while-revalidate=7200, immutable',
},
})
}

const search = url.search ? url.search : '' // preserve query string

let destination
Expand Down
2 changes: 1 addition & 1 deletion src/utils/get-url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getLearningCenterURL = () => {
}

export const getSupportURL = () => {
return 'https://help.vtex.com/en/support'
return 'https://help.vtex.com/support'
}

export const getLinkedinURL = () => {
Expand Down
Loading