How can I redirect an article?

Avatar
  • updated
  • Answered

I have an article which has been replaced by more suitable content elsewhere. In case the UserEcho URL has been linked to from other websites, I would like to keep the URL active but setup a 301 redirect to the new content. Is there a way to do this?

Pinned replies
Avatar
Vladimir Mullagaliyev co-founder
  • Answer
  • Answered

Hello Chris,

You cannot do it in one click, but you still be able to do it via Custom JS script.

Open your project settings. Then "Custom CSS/JS", then "JS script".

Here add something like that (this is just an example):

<script>
// this method starts on documentLoaded event
initqueue.push(function(){
    // you can use JQuery here
    // check if this is topic view and topic id is what you need to redirect
    if ($("body.view-topic").length > 0 && $(".topic-item.topic-item-full").attr('data-topic-id') == "change_to_your_topic_id"){
    window.location.href='your_url_to_redirect';    
    }
})
</script>

We did not test this example, but it could work for you if you will replace a few places.

Avatar
Vladimir Mullagaliyev co-founder
  • Answer
  • Answered

Hello Chris,

You cannot do it in one click, but you still be able to do it via Custom JS script.

Open your project settings. Then "Custom CSS/JS", then "JS script".

Here add something like that (this is just an example):

<script>
// this method starts on documentLoaded event
initqueue.push(function(){
    // you can use JQuery here
    // check if this is topic view and topic id is what you need to redirect
    if ($("body.view-topic").length > 0 && $(".topic-item.topic-item-full").attr('data-topic-id') == "change_to_your_topic_id"){
    window.location.href='your_url_to_redirect';    
    }
})
</script>

We did not test this example, but it could work for you if you will replace a few places.