Redirecting traffic from deleted help center articles

Return to top


  • David Halewood

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


  • Devan - Community Manager
    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. 

  • 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.

  • Kay
    Community Moderator

    Hi David,

    For a hostmapped domain (example: 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.
  • James May

    Hi everyone i need to redirect from a deleted .pdf

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


  • Jules


    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?
  • 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 = '' + 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!

  • 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:

    What's wrong?



  • 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 = ‘’ + newIds[i];

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

    $(document).ready(function() {
  • 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: 


    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.

  • 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...

  • 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! 

  • 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 = '';


    <h2 class="not-found">{{t 'nonexistent_page'}}</h2>
  • 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!


Please sign in to leave a comment.

Powered by Zendesk