---
url: https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/
title: "RedirectsHandler.js\n                #"
description: "The RedirectsHandler class is responsible for validating whether a given URL matches any routes configured for redirection. The list of routes is provided durin"
lang: uk
updated: 2026-09-12T11:08:32.852Z
---

# RedirectsHandler.js [#](https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/#redirectshandler-js)

## Overview [#](https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/#overview)

The RedirectsHandler class is responsible for validating whether a given URL matches any routes configured for redirection. The list of routes is provided during the initialization of the class instance, which occurs for every incoming request.

---

## Content [#](https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/#content)

-   [RedirectsHandler.js](#redirectshandlerjs)
    -   [Overview](#overview)
    -   [Content](#content)
    -   [Methods](#methods)
        -   [`checkRedirects`](#checkredirects)

---

## Methods [#](https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/#methods)

### `checkRedirects` [#](https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/#checkredirects)

-   **Purpose**: Checks if url match with redirects "from"
    
-   **Parameters**:
    
    -   `url`: (string): url .
-   **Returns**: An object contain urls in "from" (string) and "to" (string).
    
-   **Behavior**: Checks if url match with redirects "from".
    

---

## Config structure [#](https://gudhub.com/uk/docs/ssr-ssg/server/features/redirects-handler/#config-structure)

Here you can add new redirects or delete existing ones:

Копіювати

```js

export const redirects = [
  {
      from: "/your-website/route/",
      to: "/new/your-website/route/"
  },
    ...
]
```

| Property Name | Type | Description |
| :-- | :-- | :-- |
| `from` | `string` | _old route_ |
| `to` | `string` | _new route_ |

> This **must be an array of objects**, each of which **contain from and to properties**.
