US English (US)
BS Bosnian

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Book a Demo
  • Product Updates
  • Contact Us
English (US)
US English (US)
BS Bosnian
  • Home
  • Customization
  • Customization Guides
  • Advanced Customization

How to create custom redirects via JavaScript?

In this guide, we will cover how to create custom redirects directly from the customize section of your Knowledge Base.

Written by Guilherme Arantes

Updated at September 24th, 2024, by Guilherme Arantes

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Users Accessibility New to Helpjuice? Start Here Content Management Multiple Languages/Translations & Localization Multilingual Knowledge Bases Analytics Video Tutorials
  • Customization
    Customization Guides
  • API V2
  • API V3 and Webhooks
  • Article Editor
  • Billing / Subscription
  • Authentication
  • Pricing
  • Swifty AI Chatbot
  • Swifty AI Helpbar
  • What's New
+ More

Table of Contents

Multilingual KBs Example

Custom redirects are redirects that are not covered on the Article Redirects feature, learn more at How to Create Article/URL Redirects. For instance:

  1. Redirects from valid URLs on your KB;
  2. Redirects based on search parameters or event listeners;

In order to redirect users before the page is fully loaded, place the code in the Main Layout file, inside the HEAD tag.

Multilingual KBs

If your Knowledge Base is multilingual, please notice that you have multiple Main Layout files, each one specific to a language section.

 

Example

<script>
if (location.pathname === "/en_US") {
    location.href = "/en_GB";
}
</script>

In this example, we created a redirect from the English (US) language section to the English (UK) section. You might want to use liquid tags to create more robust/complex redirects, learn more at Shopify/Liquid Variables and Objects Reference.

javascript custom redirects

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to Create Article/URL Redirects
  • How To Archive And Unarchive Content

Copyright © 2025 - Helpjuice

Helpjuice, Inc. is a registered US Corporation, EIN # 45-2275731

Download W9
  • Help
  • Features
  • Pricing
  • About
  • Careers
  • Customers
  • Blog
  • Case Studies
  • Resources
  • Knowledge Base Examples
  • Privacy Policy
  • Terms of Service

Why is the knowledge base important?

With a knowledge base, you can allow your customers to self-help themselves, thus reducing your customer support by up to 60%. Furthermore, you can also have your team get instant answers to the questions they need without having to email themselves all using knowledge base software.

What is the purpose of a knowledge base?

The purpose of knowledge base software is to allow you to host your knowledge base/corporate wiki in one centralized 'hub'. Both your customers, and employees can now access information within seconds!

Made with from Miami, Bosnia, Morocco & Brasil

+1 (833) 387 3877 support@helpjuice.com
Expand