---
title: "Redirects - Serpwise Documentation"
description: "Manage exact-match and regex redirects at the edge, import them by CSV, and support up to 10,000 redirects per domain."
url: "https://serpwise.ai/docs/redirects/"
source: "https://serpwise.ai/docs/redirects/"
---
[Back to Serpwise](/)

Serpwise Documentation

Connect · Configure · Execute

Search documentation

`/`

No documentation found.

↑↓ Navigate Enter to open

Browse documentation

The **Redirects** feature (also called Legacy URL Saver) lets you manage URL redirects directly in Serpwise, without touching your web server config, `.htaccess` file, or CDN rules.

Redirects are handled by the gateway **before** fetching from your origin server - matching requests are returned immediately with the appropriate redirect response, so your origin never sees the traffic and latency is minimal.

## When to Use Redirects

- **Site migrations** - redirect old URLs to new ones after a redesign or CMS change
- **URL structure changes** - redirect `/old-category/post-name` to `/new-category/post-name`
- **Retired pages** - redirect discontinued product or service pages to relevant alternatives
- **Domain consolidation** - redirect from non-www to www, or HTTP to HTTPS (at the path level)
- **Affiliate or campaign links** - create clean short paths that redirect to longer URLs

## How Redirects Work

The gateway uses a two-tier matching system evaluated in order:

### Tier 1: Exact Match

Exact redirects use a hash map for O(1) lookup - the path is looked up directly, with no iteration required. This makes exact matches extremely fast regardless of how many redirects you have.

The match is against the URL **path only** - query strings are not included in the match key, but can optionally be preserved in the redirect response.

### Tier 2: Regex Match

If no exact match is found, the gateway evaluates regex redirects in **priority order**. The first pattern that matches wins.

Regex redirects support **capture groups** - you can reference captured parts of the URL in the destination using `$1`, `$2`, etc.

## Redirect Status Codes

| Code  | Name               | Use Case                                            |
|-------|--------------------|-----------------------------------------------------|
| `301` | Moved Permanently  | Page has permanently moved; passes most link equity |
| `302` | Found (Temporary)  | Temporary redirect; does not pass link equity       |
| `307` | Temporary Redirect | Temporary; preserves original HTTP method           |
| `308` | Permanent Redirect | Permanent; preserves original HTTP method           |

## Query String Handling

Each redirect has a **preserve query string** option:

- **Enabled** - the query string from the original request is appended to the destination URL
- **Disabled** - the redirect goes to the exact destination URL with no query string

Example with preservation enabled:

```
Original:    /old-page?utm_source=email&utm_campaign=spring
Destination: /new-page
Result:      /new-page?utm_source=email&utm_campaign=spring
```

## Adding Redirects

### Single Redirect

Click **Add Redirect** in the Redirects tab to create a redirect manually:

| Field                     | Description                                                   |
|---------------------------|---------------------------------------------------------------|
| **Source path**           | The path to match (e.g. `/old-page` or `^/blog/([0-9]+)/.*$`) |
| **Destination**           | Where to redirect (e.g. `https://www.example.com/new-page`)   |
| **Type**                  | `exact` or `regex`                                            |
| **Status code**           | `301`, `302`, `307`, or `308`                                 |
| **Preserve query string** | Whether to append the original query string                   |
| **Priority**              | For regex redirects, lower numbers are evaluated first        |
| **Enabled**               | Enable or disable without deleting                            |

### Bulk Import via CSV

For large redirect lists (site migrations often involve hundreds or thousands of redirects), import a CSV file.

**CSV format:**

```
source,destination,type,status_code,preserve_query_string
/old-page,https://www.example.com/new-page,exact,301,false
/blog/2019/.*,https://www.example.com/blog/,regex,301,false
/product/([a-z-]+),https://www.example.com/products/$1,regex,301,true
```

| Column                  | Required | Values                       |
|-------------------------|----------|------------------------------|
| `source`                | Yes      | Path string or regex pattern |
| `destination`           | Yes      | Full destination URL         |
| `type`                  | Yes      | `exact` or `regex`           |
| `status_code`           | Yes      | `301`, `302`, `307`, `308`   |
| `preserve_query_string` | Yes      | `true` or `false`            |

### Export to CSV

Download all your current redirects as a CSV file using the **Export** button. Use this to:

- Back up your redirect list before making bulk changes
- Edit redirects in a spreadsheet and re-import
- Migrate redirect lists between domains or environments

## Limits

Each domain can have up to **10,000 redirects**. This limit applies to the total combined count of exact and regex redirects.

For larger redirect requirements, contact support to discuss options.

## AI-Created Redirects

When [AI Auto-Redirects](/docs/auto-redirects) creates a redirect from a 404 suggestion, the row is marked with an **AI** source badge. Use that badge to filter AI-created redirects, inspect the original suggestion, or bulk-revert AI redirects without changing manual or CSV redirects.

AI-created redirects still use the same gateway redirect system described on this page. The AI layer only decides which redirect to create; the gateway serves it with the same fast exact or regex matching.

## Priority for Regex Redirects

When you have multiple regex redirects, the gateway evaluates them in priority order (ascending - lower numbers run first). Only the **first matching regex** is applied; subsequent patterns are not evaluated.

Order matters: put more specific patterns before more general ones.

```
Priority 1: ^/blog/featured/([a-z-]+)$  → /features/$1
Priority 2: ^/blog/([a-z-]+)$           → /articles/$1
```

In this example, `/blog/featured/my-post` matches Priority 1 and is redirected to `/features/my-post`. It never reaches Priority 2.

## Regex Examples

### Redirect all pages under an old path

```
Source:      ^/old-section/.*$
Destination: https://www.example.com/new-section/
Type:        regex
Code:        301
```

### Redirect with URL slug preservation

```
Source:      ^/products/detail/([a-z0-9-]+)$
Destination: https://www.example.com/shop/$1
Type:        regex
Code:        301
```

`/products/detail/blue-widget` → `https://www.example.com/shop/blue-widget`

### Redirect dated blog URLs

```
Source:      ^/blog/[0-9]{4}/[0-9]{2}/([a-z0-9-]+)$
Destination: https://www.example.com/blog/$1
Type:        regex
Code:        301
```

`/blog/2019/04/my-first-post` → `https://www.example.com/blog/my-first-post`

[**Automatically Fix 404s with AI**  
→  
\
Configure AI detection, confidence thresholds, daily digests, and safety controls.](/docs/auto-redirects)

[**Reviewing AI Redirects**  
→  
\
Approve, reject, apply, and bulk-revert AI redirect suggestions.](/docs/auto-redirect-review)