How to redirect old portal to new portal by giving new portal link in the old theme header?

Akula M S G Dev
Tera Contributor
 
4 REPLIES 4

manjusha_
Kilo Sage

@Akula M S G Dev 

You can replace Theme of old portals. Theme allows to include JS Includes, which will be loaded on attempt to display of every URL of old portals. Thus, you can create UI Script, which makes redirection to new portal, and load it as part of "Redirection Theme", which you assign to all old portals. The code of UI script can look as following:

(function () {
    var loc = window.location;
    //var oldUrl = loc.protocol + "//" + loc.host + loc.pathname + loc.search + loc.hash;
    var newUrl = loc.protocol + "//" + loc.host + "/newPortal" + newSearch + loc.hash;
    window.location.replace(newUrl);
})();

The method location.replace allows to redirect to new URL in very clean way. 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. As the result users will be able to use old links (for example links from old emails) and access to new URLs instead of old one. You can make the above code more complex and implement more complex algorithm of replacing of old URL to new one.

View solution in original post

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact

Thanks,

Manjusha Bangale

 

Hi Manjusha,

 

I want this particular scenario only when users clicks on Notification Links(URI_REF). should go to new portal(ESC).

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Not sure, though maybe this helps:
- 2021-09-27 - Article - Redirect (inactivate) Service Portal, e.g. from /sp to /esc

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

manjusha_
Kilo Sage

@Akula M S G Dev 

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact
 
Thanks,
Manjusha Bangale