Dear Community,
I’ve got a question
In practical terms: How do I “redirect” any Ideation Link to send to another page instead?
In technical terms: How do I "redirect" users that visit a URL that contains a specific string (community.mycompany.com/ideas), to a different page we have defined (“new URL”)?
I know of a Third-Party-Script that was shared with me by the amazing Lauro from Support (shoutout)!
This one works fine But it only applies to URLs that exactly match “old URL”.
<script>
if (window.location.href == 'https://community.mycompany.com/ideas') {
window.location = "new URL"
}
</script>
Now I don’t want only URLs that exactly match https://community.mycompany.com/ideas
The one below did not work well
<script>
if (!window.location.pathname.startsWith('/community.mycompany.com/ideas')) {
window.location.href = "new URL"; }
</script>
This is the one I actually want to use, so for all pages that contain the string community.mycompany.com/ideas, so any kind of ideation content, including the homepage.
It did not work well, meaning: any destination page kept reloading.
Does anybody know what I might be doing wrong?
Or is there an alternative, better solution?
Thank you so much in advance,
Daniele