---
title: "Redirect from the home page to a specific URL"
id: "redirect-from-homepage-to-a-specific-url"
project: "ClickHelp Knowledge Base"
url: "https://docs.clickhelp.com/articles/clickhelp-knowledge-base/redirect-from-homepage-to-a-specific-url"
updated: 2026-09-11T05:23:29Z
---

# Redirect from the home page to a specific URL

If you don't need a [Home Page](https://clickhelp.com/software-documentation-tool/user-manual/portal-home-page.html) - for example, when you only need one online publication or want to redirect users to a specific topic, you can set up a redirect with the help of the Branding Script.

Branding Script - this is a small JavaScript file that will load on any page a reader opens.

## How to Implement

1. You can create a new branding script file in your portal settings (**Tools** → **Portal Settings** in the top menu): 
 ![](/resources/Storage/clickhelp-knowledge-base/aWUSJxUyxb.png)
2. Once the new script file is created, it opens in a new browser tab. Click **Lock&Edit**, delete the default file content, and copy&paste the following code there:
 
```javascript
function redirectHome()
{
  if ((window.location.pathname == '/') || (window.location.pathname.indexOf('/home') == 0))
  {
    // Put the needed URL here in single quotes
    window.location.href = 'https://clickhelp.com/';
  }
}

redirectHome();
```

3. In the code, you'll need to put your publication URL in this line instead of our web site URL:
 
```javascript
window.location.href = 'https://clickhelp.com/';
```


Once you save the changes, all readers who open the Home Page will be redirected to the publication you specify.

| ![](/resources/Storage/clickhelp-knowledge-base/ClickHelp%20Product%20Documentation_Files/Images/quick-parts/icon-info.svg) | Note |
| --- | --- |
| For authors, who need to log in to the portal, just add "/login" after the portal domain name to go directly to the Login screen instead of the Home page, so the redirection does not happen. |

## Redirect from the Home Page to the Login page

If you want to set up a redirect from the Home Page to the Login page for all unauthenticated users, the script above won't work. It will redirect all users to the Login page — anonymous and already logged-in users. Use the following script instead:

```javascript
function redirectHome()
{
  if ((window.location.pathname != '/') && (window.location.pathname.indexOf('/home') != 0))
    return;

  if (window.document.getElementsByClassName("CHUserProfileLink").length > 0)
    return;
  
  if (window.document.getElementsByClassName("Home_customContent").length == 0) {
    setTimeout(redirectHome, 500);
    return;
  }

  window.location.href = '/login';
}

setTimeout(redirectHome, 500);
```

When applied, this script will redirect all anonymous users from the Portal Home page to the Login page and will not affect authenticated users.

* * *
  
 *The information and examples in this Knowledge Base are presented "as is" and for informational purposes only — we do not provide Technical Support for it. Neither can we guarantee that the examples provided will work as intended in your particular scenario, nor do we provide assistance in customizing these examples to fit your use case.*