Redirecting traffic from deleted Help Center articles

Have more questions? Submit a request

30 Comments

  • Joe Fedric
    Comment actions Permalink
    1
  • Stephen
    Comment actions Permalink

    Is there a non-Javascript method to control redirected traffic? Javascript assumes that users have JS enabled. This also doesn't seem very scalable to manage content long-term, because we have limited ability to see the redirects, for control and for analytics.

    3
  • Scott
    Comment actions Permalink

    There is an error in the following line:

    if ( isArticle && notDefaultLaugage && isErrorPage ) {

    Should be notDefaultLanguage.

     

    1
  • Merav B
    Comment actions Permalink

    Thanks for pointing on that error! It works for me now.

     

    0
  • Jessie Schutz
    Comment actions Permalink

    Thanks for the heads-up, Scott! I've contacted our Docs team so we can get that fixed.

    0
  • Steve Graham
    Comment actions Permalink

    I put in some redirects and it doesn't work on a phone - the "?mobile_site=true" parameter seems to cause a problem, although I'm not sure why.  I've tested it other ways and it works fine, even with dummy content after the ID or "?asdfads=asdfasdfasd" and it redirects.  But for some reason with "?mobile_site=true" it doesn't redirect.

    1
  • Brooke Wayne
    Comment actions Permalink

    I would like to second Stephen's point above - a non-JS method would be greatly appreciated! 

    1
  • Nicole - Community Manager
    Comment actions Permalink

    Hey Brooke - 

    Thanks for the feedback, and welcome to the Zendesk Community!

    0
  • Jessie Schutz
    Comment actions Permalink

    Hey Steve! Welcome to the Community!

    So I don't really know much of anything about JS, but I had a thought. Are you using the Copenhagen theme? It's a responsive theme so there's no mobile version per se...do you think that could be the issue?

    0
  • Brooke Wayne
    Comment actions Permalink

    Hey, wondering for an update on this! It's 2018, and we're hitting a lot of roadblocks where deleted links are becoming more costly for our product. 

    Would love to see a solution to set up redirect links for deleted articles - that doesn't involve Javascript. 

    2
  • Ehsan Mafi
    Comment actions Permalink

    +1

    When deleting or unpublishing an article, it would be awesome if you could specify right then & there the new article that you want to redirect the old link to.

    4
  • Nicole - Community Manager
    Comment actions Permalink

    Hey all - 

    Our Product Managers are finding it too difficult to follow all of the feedback coming in on article comments, and have asked that you head on over to the product feedback topic in the Community to share feedback and get updates on what's coming. 

     

    -5
  • Joe Fedric
    Comment actions Permalink

    Really?!

    Give us normal 30x redirect facilities for articles.  How hard can that be?  We're using two Help Centers, and I have to maintain two separate JS redirect banks on my HCs.  Also, your JS code here is pretty bad.  It doesn't allow for easy maintenance of the records you're updating, without refactoring it, because you have to try to match the redirects in the list in a 1:1 fashion.  I had a developer at my company see what you had offered, and how upsetting maintaining just a dozen redirects turned into (bad, bad, bad jumble).  In fact, here's the refactored code:

    //Use this for same domain redirects
    var one = {
    "Old ID 1" : "New ID 1", //Help Center 1, Old Article 1 to New Article 1
    "Old ID 2" : "New ID 2", //Help Center 1, Old Article 2 to New Article 2
    "Old ID 3" : "New ID 3", //Help Center 1, Old Article 3 to New Article 3
    "Old ID 4" : "New ID 4" //Help Center 1, Old Article 4 to New Article 4
    };
    //Use this for different domain redirects (multiple HCs)
    var two = {
    "Old ID 1" : "New ID 1", //Help Center 2, Old Article 1 to New Article 1
    "Old ID 2" : "New ID 2", //Help Center 2, Old Article 2 to New Article 2
    "Old ID 3" : "New ID 3", //Help Center 2, Old Article 3 to New Article 3
    "Old ID 4" : "New ID 4" //Help Center 2, Old Article 4 to New Article 4
    };
    //Loops for redirects
    for (var keytwo in two){
    if (window.location.href.indexOf(keytwo) > -1){
    window.location.href='http://your-first.domain.com/hc/en-us/articles/' + two[keytwo];
    }
    };
    for (var keyone in one){
    if (window.location.href.indexOf(keyone) > -1){
    window.location.href = 'https://your-second.domain.com/hc/en-us/articles/' + one[keyone];
    }
    };

    Provide a real facility for doing this.  Redirects are a huge part of how Zendesk works, and the fact that it's not included in the feature suite, and that you've asked us to abandon this thread for the feedback forums, where there is no thread on this topic (I searched 25 pages before I couldn't take it anymore) -- I am utterly stunned that you're claiming this is too difficult to follow.

    Perhaps you should put a product architect, instead of a product manager, on this problem.  The fact that the article was published over 2 years ago, with the JS code to work around the redirect problem we have with this system, is inexcusable.  It just needs to be fixed.  An explanation is not necessary.  A solution is, however.  Don't even get me started on how hard it is to pull a list of all tags out for reporting.  Some of the basic functions that ZD excludes makes for some serious sore spots, and that they've been unaddressed through a re-brand (over 14 months ago, btw), and are now being pushed around communities, baffles me.

    I also noticed that you've deleted most of the comments in this thread, several of them belonging to me.  This problem has been around FOREVER, and was addressed with this article beginning in 2014.  I've saved this answer so I can repost it, should your delete finger get "itchy".

    7
  • Stephen
    Comment actions Permalink

    "Product Managers are finding it too difficult to follow all of the feedback coming in on article comments." So you expect us, your customer, to sift through 121 pages of feedback points to submit our own comments? How about making it easy for us to be customers and to give feedback, and Zendesk taking the responsibility for cultivating our comments in a way that works for everyone? 

    3
  • Brooke Wayne
    Comment actions Permalink

    @stephen @joe: If it helps, I found a page in the Community that fits the topic and just copied + pasted my comment from above there.

    For what it's worth, I'm in complete agreement with both of your comments too.

    1
  • Nicole - Community Manager
    Comment actions Permalink

    Hey Stephen - 

    We're trying to simplify it by keeping all of the conversations in the Product Feedback threads. You can do a quick search to see if there's a thread relevant to your feedback and if not, create a new post. 

    We're trying very hard to cultivate your comments in a way that works for everyone, and that may be reflected in new processes or a different means of collecting feedback altogether in the future. For the moment, we are trying to focus things in the Product Feedback topic. 

     

    0
  • David A.
    Comment actions Permalink

    Hi,

    How do I redirect a knowledgebase article to an external URL?

    In this case, the URLs are on our company website.

    0
  • Vladan Jovic
    Comment actions Permalink

    Hi David, in case you've missed it, here is my comment about this question:

    https://support.zendesk.com/hc/en-us/community/posts/360004154368-How-do-I-redirect-a-knowledgebase-article-to-an-external-URL-?page=1#community_comment_360001898947

    Let me know if this doesn't help. :)

     

    0
  • David A.
    Comment actions Permalink

    Awesome! Thank you, Vladan :)

    0
  • Nan Yu
    Comment actions Permalink

    Hey @vladen, @nicole / product managers at Zendesk. It's pretty disappointing that you don't offer basic 301 redirect functionality and we have to resort to JS hacks to make this work.

    Issues like this make it seem like our business is not something you're interested in keeping in the long run.

    2
  • Kelly Sofia
    Comment actions Permalink

    Is there a way to do this with deleted sections (instead of articles) - we've shifted articles from a discontinued section. 

    0
  • Vladan Jovic
    Comment actions Permalink

    Hey Kelly, sorry for the delayed reply! Somehow I've missed your comment.

    So, if you mean to redirect an old Section page to another, yes you can do that.

    This code is still valid for such a case, but instead of article ID, you need to put Section ID.

    Please try it out and let us know how it goes. Thanks! 

    0
  • Kelly Sofia
    Comment actions Permalink

    Hi Vladan,

    Not a problem! I gave it a try today but I had to create a separate section in my JS file and update the link so it was using the /categories/ URL instead of /articles. It's worked, which is great. 

    This is the code I used (I've stripped out our unique information of course):

    var oldIds = ["123"];
    var newIds = ["456"];

    for (var i = 0; i < oldIds.length; i++){
    if (window.location.href.indexOf(oldIds[i]) > -1) {
    window.location.href = 'https://[company].zendesk.com/hc/en-us/categories/' + newIds[i];
    }
    }

    0
  • Jessie Schutz
    Comment actions Permalink

    Hi Kelly! Glad to hear you got it working!

    0
  • Vladan Jovic
    Comment actions Permalink

    Hey Kelly, glad you've sorted it out!

    Also, thanks for sharing your code, it looks great!

     

    0
  • Scott Havard
    Comment actions Permalink

    Hi all!

    Like everyone else, I really need redirection functionality. While I prefer a 30x redirect, this isn't currently possible so, similar to the folks above, I have built a javascript workaround that I would like to share. 

    https://github.com/scotthavard92/Zendesk-Help-Center-Redirection

    The instructions are in the repository, but it largely involves the same procedure as the solutions above. Throw the snippet into your <head>, which is [in most cases] located in the document_head.hbs file. 

    Ideally this is a little more scaleable than looping through every redirection option because I used a hash map instead. So based on an old article ID it will look up a new article ID, and not loop through every option.

    The list is also easier to maintain, as it maps out cleanly:

    old id 1 = new id 1, old id 2 = new id 2, etc.

    Feel free to reach out with any questions!

    0
  • Monica
    Comment actions Permalink

    I implemented the redirecting untranslated articles to an existing language example.  It works well except if the other language's version exists as a draft.  Does anyone have suggestions on how to edit the code such that it also works for draft/unpublished versions?  This is mostly used when we're staging a language to turn on at once and would like them directed to the default until it's live.

    I think this might have to do with how the drafts send people to log in.  I'd prefer it would direct them to the default language rather than log-in process.

    0
  • Brett - Community Manager
    Comment actions Permalink

    Hey Monica,

    Any chance you could provide the existing code you're implementing? This may help other users jump in and offer up some alternatives for you.

    Thanks!

    0
  • Monica
    Comment actions Permalink

    I'm using the code from the redirecting untranslated articles to an existing language example in the script.js file.

    // Redirect Untranslated to Default Language
    var notDefaultLanguage = window.location.href.indexOf('/en-us/') == -1;
    var isArticle = window.location.href.indexOf('/articles/') > -1;
    var isErrorPage = $(".error-page").length > 0;


    if ( isArticle && notDefaultLanguage && isErrorPage ) {
    var newURL = window.location.href.replace(/(.*\/hc\/)([\w-]+)(\/.*)/, "$1en-us$3");
    window.location.href = newURL;
    }

     

    Since the language variant is a draft, it's routing to the log-in function which we have a JSON Web Token (JWT) set up.  I am not sure where in the code the system directs to log in rather than the error page for a draft language variant.  Ideally, I'd want to interrupt the redirect to log-in and send them to the default page.

    0
  • Brett - Community Manager
    Comment actions Permalink

    Hi Monica,

    As far as I know, when an anonymous user attempts to access an article they do not have access to, they will automatically be directed to the login page.

    I'm not exactly sure how you would go about redirecting them to a page they do have access to other than using custom code.

    I'll leave this post open in case other users want to jump in and offer up advice on how to set this up on your end.

    I'll also reach out to our Zendesk Moderators to see if they have any guidance.

    Cheers!

    0

Please sign in to leave a comment.

Powered by Zendesk