# Redirect Generator

> Turn old paths and new URLs into 301, 302, 307 or 308 redirect rules for Apache .htaccess, Nginx, Cloudflare, Netlify, Vercel and Next.js. Copy or download.

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

## How to use it

1. **Add each redirect.** Old path on the left, new path or full URL on the right.
2. **Pick the status.** 301 for permanent moves, 302 for temporary ones.
3. **Choose your host.** Switch between Apache, Nginx, Cloudflare, Netlify, Vercel and Next.js.
4. **Copy or download.** Add the rules to your config and deploy.

## When you need redirects

Any time a URL changes: a renamed page, a new blog structure, a merged product, a move to a new domain. Without a redirect, old links and search results hit a 404 and the authority those links earned is lost. With a permanent redirect, visitors and search engines land on the new page and most of that value carries over.

## Which status code

- **301 Moved Permanently.** The default for SEO. The old URL is gone for good; search engines replace it with the new one.
- **308 Permanent Redirect.** Same meaning as 301, but the request method is kept, so a POST stays a POST. Vercel and Next.js use it for permanent redirects.
- **302 Found.** Temporary. Search engines keep the old URL indexed. Use it for short promotions or A/B tests.
- **307 Temporary Redirect.** Temporary, and keeps the method.

For a page that has moved, use 301 or 308. Google treats them the same.

## Per host

- **Apache** reads `.htaccess` with mod_rewrite. Rules go near the top, before any framework rewrites.
- **Nginx** uses exact `location =` blocks inside your `server` block. Reload Nginx after editing.
- **Cloudflare Pages and Netlify** read a `_redirects` file in the build output: `/from /to 301`.
- **Vercel** reads a `redirects` array in `vercel.json`.
- **Next.js** returns the array from `redirects()` in `next.config.js`.

## Avoid chains and loops

Point every old URL straight at its final destination. A redirect to a page that itself redirects slows visitors down and leaks value; a loop breaks the page entirely. After deploying, test a few old URLs with the [redirect checker](/tools/redirect-checker), then update internal links and your [sitemap](/tools/sitemap-generator) to use the new URLs directly.

## What you get

- 301, 302, 307 and 308 per row
- Six outputs: Apache, Nginx, Cloudflare, Netlify, Vercel, Next.js
- Bulk paste of many redirects
- Full URLs trimmed to paths automatically
- Download the config file

## Questions

### What is the difference between a 301 and a 302 redirect?

A 301 is permanent: search engines drop the old URL and pass its signals to the new one. A 302 is temporary: the old URL stays indexed. Use 301 for moved pages.

### Is a 308 redirect the same as a 301 for SEO?

Yes. Google treats 308 and 301 as permanent redirects in the same way. The only difference is that 308 keeps the HTTP method, which matters for forms and APIs.

### How do I redirect a page in .htaccess?

Enable mod_rewrite with RewriteEngine On, then add RewriteRule ^old-page$ /new-page [R=301,L]. This tool writes those lines for each redirect you add.

### How long should I keep redirects in place?

At least a year, and ideally for good. Old links on other sites and in bookmarks keep sending visitors long after search engines have updated.
