# Redirect Generator

Turn a list of old and new URLs into redirect rules for lobsite.toml, Netlify, Vercel, Nginx and Apache .htaccess, with loops and chains caught.

Use it at https://lobsite.com/tools/redirect-generator

## How to use it

1. Paste your redirects, one per line: the old path, the new path or URL, and optionally the status (301 when you leave it out).
2. Pick where they're going: `lobsite.toml`, Netlify or Cloudflare Pages (`_redirects`), Vercel (`vercel.json`), Nginx, or Apache (`.htaccess`).
3. Fix anything the checks find, try a few paths in the box below, then copy or download the rules.

Moving from Netlify or Cloudflare Pages? Paste your `_redirects` file as it is.

## Patterns

- `:name` matches one path segment and can be used in the target: `/blog/:slug /posts/:slug`.
- A final `*` matches the rest of the path, which is `:splat` in the target: `/docs/* /guide/:splat`.
- The query string is passed on to the new address.
- Rules are checked from the top and the first match wins, so put specific rules before general ones.

The same rules work in [lobsite.toml](https://lobsite.com/docs#config). For Nginx and Apache, patterns become regular expressions with numbered groups.

## Which status to use

- **301** (permanent): the page has moved for good. Search engines move its ranking to the new address. Use this for most site moves.
- **302** (temporary): the original address will come back, such as during a sale or maintenance.
- **308** and **307**: the permanent and temporary versions that keep the request method, for forms and APIs that POST to the old address.

## Loops and chains

A **loop** (`/a → /b → /a`) means the page never loads. A **chain** (`/a → /b → /c`) works, but each hop adds a round trip and search engines may stop following after a few. The generator catches both, along with duplicate rules, where only the first one is used.

## Frequently asked questions

### How many redirects can I have?

`lobsite.toml` takes up to 1,000 rules. For whole sections, use a pattern like `/old-blog/* /blog/:splat` instead of one rule per page.

### Can the old address be a full URL?

Paste it and the generator keeps just the path: redirects apply to the site they're deployed with. To move a whole domain, point it at the new site and redirect there.

### Do redirects work without server access?

On Lobsite, Netlify, Vercel and Cloudflare Pages they're part of the deploy, so no server access is needed. On a plain file host, the fallback is a page with `<meta http-equiv="refresh" content="0; url=/new">`, which search engines treat like a redirect.

### Is anything sent to a server?

No. The rules are checked and written in your browser.

