I have a site called support.domain.com lives in one org

And i have build a community with same content called support.domain.com/s/ in different org

i am trying to retraid the old site and use the community instead

so i want to redirect all user that have the old Urls to get to the new ones

Example--- OLD Site: support.domain.com/articles/pagename to NEW Community: support.domain.com/s/article/pagename

so i am just wondering if it's possible using code apex to mape it or entering every URL into salesforce one at a time


Just add a script on the page to redirect -

let url = window.location.href;
url = url.replace("/articles","/s/article");

With replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it - https://developer.mozilla.org/en-US/docs/Web/API/Location/replace#:~:text=The%20replace()%20method%20of,button%20to%20navigate%20to%20it.

  • There is any way to do the redirection in the community instead old site VF page since we will get retired the VF page in the future? – Akouayri Hamza Aug 25 '20 at 1:51
  • I mean in the communities landing controller – Akouayri Hamza Aug 25 '20 at 3:55
  • Okay, in that case, if you want to redirect them during login you could try this answer - salesforce.stackexchange.com/questions/17054/…. Make sure the PageReference url you enter is the full URL for your new site. – Jitender Padda Aug 25 '20 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.