Redirecting traffic from deleted help center articles

Return to top

55 Comments

  • David Halewood

    Say we wanted to redirect all articles of one brand to a new brand is that possible?

    Thanks

    0
  • Devan La Spisa
    Zendesk Community Manager

    Hello @...,

    This article's information with some changes to fit your use case is the best documentation we have available for this ask. I'll reach out to our moderator team to see if they can offer son insight into making these changes. We'll also share this post in our weekly digest so others can share that advice on how to accomplish this. 

    Best regards. 

    0
  • David Halewood

    Hi @..., thanks, would the above solution work across brands, it should from what I've seen but I wonder how SEO might be impacted. We are keen to retain relevance whilst redirecting to our new brand.  Any help from the moderator team would be greatly appreciated.

    0
  • Kay
    Community Moderator

    Hi David,

    For a hostmapped domain (example: cocacola.com/help) you can set-up a 301 Redirect via a .htaccess file.

    Using the .htaccess method won't impact your SEO. The JS redirect might have impact on your SEO.
    From an SEO point of view, a JavaScript redirect is not the most optimal way of redirecting because search engines need to render a page to find the redirectRedirecting using a 301 redirect is always recommended (except if you're looking to temporarily redirect)

    Articles still have the same ID
    If your articles still have the same ID, then you need 1 redirect line.

    Articles with changed IDs
    You will need a single redirect line for each article if your articles no longer have the same article ID.
    0
  • James May

    Hi everyone i need to redirect from a deleted .pdf

    All the methods suggested dont seam to work, Can anyone help? 

     

     
    https://support.support/hc/article_attachments/900009886503User_Guide_April_2021.pdf new
     
    0
  • Jules

    Hello,

    I would like to redirect untranslated articles to the default language article.

    For example, my default language is English and I have French translation. If the French translation does not exist for an article, the user who selects French, is currently redirected to the French home page. But I would like him to be redirected to the English article.

    I tried the code bellow but it doesn't change anything...

    $(document).ready(function () {
    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;
    }
    });
     
    Any idea to help?
    0
  • CJ Johnson

    The instructions on how to redirect for deleted articles, redirect all translations to English. How can I redirect from the deleted articles, to the new article in the language the user has? I tried removing the EN part from the URL, but strangely it made no difference. 

    Edit: To be super clear what code I'm talking about: 

    var oldIds = ["217352077", "216552968"]; var newIds = ["216553098", "216552958"]; for (var i = 0; i < oldIds.length; i++){ if (window.location.href.indexOf(oldIds[i]) > -1) { window.location.href = 'https://YOURSUBDOMAIN.zendesk.com/hc/en-us/articles/' + newIds[i]; } }



    Edit 2: It turns out, removing the en/ *does* work for all languages, it just took a bizarrely long time after publishing to take effect. Whoohoo! 
    https://YOURSUBDOMAIN.zendesk.com/hc/articles/

    0
  • Carlo

    Hi, we followed the instructions in the article above to redirect the untranslated article to the original article in English. However, it seems it's not working: this is an article in English that is not translated in German, but if you switch the language to German it redirects you to the home page instead of showing yout the article in English: https://zakeke.zendesk.com/hc/en-us/articles/4514828443932-Test-for-fallback

    What's wrong?

    Thanks
    Carlo

     

    0
  • GoGet Support

    Hi there, 

    We are trying: Redirecting a set of deleted articles to new article equivalents

    And have  put in these codes but they are not working. Can you kindly advise us please?

    var oldIds = [“900000500263”];
    var newIds = [“900001763763”];
                  
    for (var i = 0; i < oldIds.length; i++){
      if (window.location.href.indexOf(oldIds[i]) > -1) {
        window.location.href = ‘https://gogetmy.zendesk.com/hc/en-us/articles/’ + newIds[i];
        }
      }

    0
  • Boris Fernandez
    Don't think that solution works anymore. eg. I do not have that part on our script.js file :

    $(document).ready(function() {
    1
  • CJ Johnson

    Boris Fernandez I just double checked my setup, and it's working currently with the above example code, even without this line in the script.js: 

    $(document).ready(function()

    One thing I can think of that might be causing this to not work as expected, is that you may need to check that your script.js file is valid code syntax. If it has a syntax error, it will break the file and not fire the contents correctly. I can see that GoGet Support up there for example, if I try to visit the URL they are trying to redirect to, I can see the script.js has a syntax error on line 5, which is probably why this is not working for them. You can see in the dev console, if the script.js throws an error when the page loads.

    1
  • Boris Fernandez

    CJ Johnson  cannot make it work. Actually no error from the JS on the dev console. Not sure what I am doing wrong.

    When you say you do not need the function, how do you input the code in the script.js ? 
    I tested the error_page.hbs also to see if I could miss something but nothing off there too... 

    Everything looks pretty straight forward though...

    1
  • CJ Johnson

    Here's what mine looks like: 

    The error.hbs template would also require that you put the code inside some HTML script tags, as the template is a Handlebars file.  In script.js, this isn't necessary, since it's a javascript file. 

     

    Edit: Also, for whatever reason, it took like a solid half hour to hour for the code to start working when I deployed it the first time. I posted higher up in the thread about it, I kept trying to "fix" it when it turned out it was already working and it I had just stopped fussing at it, it would've started working after a bit. Just throwing that out there because I forgot about the weird long wait and it made me think the code didn't work either! 

    0
  • Boris Fernandez

    Ho I see why. My code is slightly different. I am not converting from one to one . I just want to redirect any 404 to the main page of the help center

    So was using that function below and then also added the corresponding not-found class to the error page. But I am always hitting a "$ is not defined" error...  (note my script is loading first and on top of anything else)

    So the main idea here is to use the following code to fully load the page before running the script. then if the "not-found" is detected to redirect to the location set...

    But no luck so far.

    $(document).ready(function() {
                if ($(".not-found").length > 0) {
                    window.location.href = 'https://xxxxx.xx.xxx';
              }
            });

    And

    <h2 class="not-found">{{t 'nonexistent_page'}}</h2>
    0
  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Boris! The reason that you're getting that error is likely related to the templating version that you're using. You can read more about that in this article, but to summarize you will now need to import JQuery into your project if you'd like to use a JQuery function. Just follow the instructions there to do that and then test this out again!

    0
  • Spencer Fleury

    So we've been using this code for a long time, and today it suddenly stopped working. We haven't modified our template in any way recently, other than to add more articles to var oldIDS and var newIDs. Has anyone else had this experience?

    2
  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Spencer! I haven't seen any reports coming through on our side of issues around this recently. The only "it just doesn't work" or "it stopped working" that I've seen has to do with the switch to v2 templating from v1, but that does not sound like it happened with you. How is the issue manifesting for your team? Are you seeing any errors in the console or failed requests in the network tab?

    0
  • Sebastian

    I also had troubles to make the reroute to standard language work. I noticed it was the jquery request to count the amount of error-page classes. The problem was that the code was outside of the

    $(document).ready(function () {

    part. Jérémy from Zendesk support mentioned that it needs to be part of DOMContentLoaded so I found that the jquery function could not work because of it not being included somewhere.

    We don't have the newest theme from zendesk, he also mentioned that maybe jquery needs to be installed if the theme is a new one. So that might be another error source if someone still struggles at this point.

    0
  • Dane
    Zendesk Engineering
    Hi Sebastian,

    It seems that your concern have been resolved on a ticket that have been submitted. The problem was with the JQuery request to count the error-page classes. But it needs to be inside of $(document).ready(function () {

     
    0
  • Sebastian

    Yes, that's correct. I missed that it wasn't inside.

    0
  • Wasabi

    How can I setup redirects from an article on a different brand? Also, following this guide isn’t working for me; it’s requiring a login when accessing the old article because it’s trying to access Zendesk admin for that article

    1
  • mfg

    I'm trying to accomplish the same redirect but with forms. for cases where the end user has a direct link to a form, I'd like to redirect traffic from an old form to another. I was curious if the code block works the same:

      var oldIds = ["217352077", "216552968", "216552902"];
      var newIds = ["216553098", "216552958", "216552944"];

    I added and updated the numbers and URL, but I'm not sure if it isn't working because this snippet or if it isn't working because my theme changes aren't proper.

    Is it possible to use this snippet for forms, not just article IDs, or is there a different recipe for forms?

     

     

     

    0
  • mfg

    To answer my question above, you can accomplish redirecting from one form to another with the same method and a few adjustments:


    //form redirect

      var oldIds = ["12500176350359", "12500154221847"]; //form IDs to be directed from

        var newIds = ["12500185961751", "12552908256535"]; //form IDs to be directed to

        for (var i = 0; i < oldIds.length; i++){

          if (window.location.href.indexOf(oldIds[i]) > -1) {

            window.location.href = 'https://[YOURSUBDOMAIN].zendesk.com/hc/en-us/requests/new?ticket_form_id=' + newIds[i];

                }

        } 

    //end form redirect
     Notes about snippet above:
    • for existing, active forms the page will load with the initial form parameter then update to the new parameter (including when the initial form is selected from list)
    • for existing, deactivated form, the page will load to the new parameter
    • for non-existing forms, page will load like normal - will load with no form selected
    • old/new ID array item counts need to match or redirect seems to fail on the element missing a twin
    • Redirect method above preserves prefilled form URL parameters including on custom fields
    • Seems a better end user experience to deactivate forms - faster load time, no visible changes.

     

    0
  • Bailey McWhorter

    Do archived articles change the analytics in Explore?

    For instance, if I have a report that shows the total # of articles views and I remove one article that had 100 views, does the report show the total #of article views drop by 100? Or does it keep track of all article views, regardless of whether they are archived? How about deleted?

    1
  • Dinos Papoulias

    So sad there isn’t a good solution for this after all these years. It’s been requested so many times. Even HelpScout with so much less functionality has a better redirect system.

    1
  • Peter F

    is it expected that the user is directed to a "page not found" when clicking the original link and then the redirect happens after 2-3 seconds? Im hoping for users to not see this as they may think that the article is gone. 

    0
  • Julio H
    Zendesk Customer Care
    Hi Bailey,
     
    Thanks for your feedback.

    Archived articles will continue showing and be counted in Explore. Only the team publishing dataset. 


     
    In the other dataset, for example, Knowledge base. In the viewed article metric, you will not be able to see the title or information about delete or archived articles, but you will be able to see the number of times those articles were viewed. 
    Articles viewed The number of articles that have been viewed at least once. Each article is counted only once, even if it is viewed multiple times.
    You can see a number 4 in the screenshot below, because of the articles deleted or archived. 


     
     
    Adding the metric interaction ID, I can see the ID of those deleted or archived articles. 


     
    For more information, please visit: Metrics and attributes for Zendesk Guide 

    I hope it helps! 

    Greetings. 
    0
  • Bailey McWhorter

    Julio-H, thank you. I don't see interaction ID or Item ID in Guide: Knowledge base. 

    0
  • Aakash Gill

    Hi,

    I added the code as suggested, and it is redirecting well.

    The only issue I'm facing is the "flickering". I see the "old" article content for some milliseconds, and then it redirects to the new article.

    Any solution to resolve this?


    Thanks 

    1
  • Sabra
    Zendesk Customer Care

    Bailey McWhorter - I believe Julio had Google Translate enabled when he took the screenshot, and while Google does it's best, it doesn't always get the technical terms for Explore quite right. which is why the name of the attributes aren't matching up exactly. Interaction ID should be Engagement ID and Item ID should be Article ID. 

    Aakash Gill - while I don't have a solution for the page flickering due to redirects, perhaps others have found a way help mitigate this and can chime in with anything custom they have done!

    0

Please sign in to leave a comment.

Powered by Zendesk