diff --git a/src/assets/js/redirect.js b/src/assets/js/redirect.js index c83285f8..4862036c 100644 --- a/src/assets/js/redirect.js +++ b/src/assets/js/redirect.js @@ -2,7 +2,11 @@ const currentUrl = window.location.href; const oldDomain = 'leilukin.neocities.org'; const newDomain = 'leilukin.com'; -if (currentUrl.includes(oldDomain)) { - const newUrl = currentUrl.replace(oldDomain, newDomain); - location.replace(newUrl); -} \ No newline at end of file +const redirectUrl = (oldStr, newStr) => { + if (currentUrl.includes(oldStr)) { + const newUrl = currentUrl.replace(oldStr, newStr); + location.replace(newUrl); + } +} + +redirectUrl(oldDomain, newDomain); \ No newline at end of file