Free tool

.htaccess Redirect Generator

Turn a simple list of old and new URLs into clean 301 (or 302) redirect rules for Apache .htaccess or Nginx — then copy and paste them straight into your config. Everything runs in your browser, nothing is uploaded.

Your redirects

Add one row per URL you want to redirect.

Old URL / path New URL / path
Redirect type
Output format

Generated config

Paste this into your Apache .htaccess file.

Review every rule before deploying. Redirects are case-sensitive on most servers — match the exact paths you use.

What is a 301 redirect?

A 301 redirect is a server rule that permanently sends visitors — and search engines — from an old URL to a new one. The browser is told the resource has moved for good, so it updates bookmarks and search engines transfer the page's ranking signals to the new address.

301 vs 302 — which to use

Use a 301 (permanent) whenever a page has moved for good: site migrations, URL restructures, merged pages, or switching to HTTPS. Use a 302 (temporary) only for short-lived detours — A/B tests, seasonal landing pages, or maintenance — where the original URL will return. 301s pass link equity; 302s generally do not.

Why redirects protect your SEO

During a migration, old URLs already have backlinks, rankings, and indexed history. A proper 301 redirect preserves that link equity by pointing search engines to the equivalent new page, avoiding soft 404s and traffic loss. Always map old URLs to the closest matching new page — not just to the homepage.

Where to put the rules

On Apache, add the generated lines to the .htaccess file in your site's root directory (make sure mod_rewrite is enabled). On Nginx, paste the location blocks inside the relevant server { } block and reload Nginx. Always keep a backup and test a couple of URLs after deploying.

Migrating a site or worried about lost rankings?

Get a free, no-obligation SEO audit from the Auckland SEO team and we'll flag broken redirects, crawl errors and quick wins.

Get a Free SEO Audit