From a list of moved URLs to rules your server understands
When a page moves, the old address needs an instruction that sends people and crawlers to the new one. Writing those instructions by hand is fiddly: Apache, Nginx, Netlify and Vercel all use different syntax, special characters need escaping, and query strings need their own handling. This generator takes a plain list of old and new URLs, one pair per line, and writes the rules for the platform you pick.
It supports four outputs: Apache .htaccess (mod_rewrite), Nginx, a _redirects file for Netlify or Cloudflare Pages, and vercel.json. You choose 301 (permanent), 308 (permanent, keeps the request method) or 302 (temporary). Along the way it skips rules that would redirect a URL to itself, warns about duplicate old URLs (the first one wins), spots chains inside your own list (A to B and B to C) and can flatten them so A goes straight to C, and detects loops in the list. Everything runs in your browser; nothing is sent to a server.
What goes in and what comes out
Paste old and new URLs separated by a space, tab or comma. Old URLs can be paths or full addresses, and can include a query string. Lines starting with # are ignored, so you can paste a commented spreadsheet export.
/blog/2019/post-title https://example.com/blog/post-title
/products?id=42 /products/blue-widget
/about-us/ /aboutFor Apache, that list becomes:
# Add to .htaccess at your site root (needs mod_rewrite)
RewriteEngine On
RewriteRule ^blog/2019/post\-title/?$ https://example.com/blog/post-title [R=301,L,NE]
RewriteCond %{QUERY_STRING} ^id=42$
RewriteRule ^products/?$ /products/blue-widget? [R=301,L]
RewriteRule ^about\-us/?$ /about [R=301,L,NE]And for Nginx:
# Add inside the server { } block of your Nginx config
location ~ ^/blog/2019/post\-title/?$ { return 301 https://example.com/blog/post-title; }
if ($request_uri = "/products?id=42") { return 301 /products/blue-widget; }
location ~ ^/about\-us/?$ { return 301 /about; }Each rule matches the old path with or without a trailing slash, so /about-us and /about-us/ both redirect. The trailing ? in the Apache query rule drops the old ?id=42 from the new address, so it does not get carried onto the clean URL.
301, 308 or 302: which code to pick
For moved content, use a permanent redirect. 301 is the familiar choice and works everywhere. 308 means the same thing to search engines but also guarantees a form POST stays a POST, which matters if any old URL receives form submissions. Vercel's permanent: true always sends 308; Google treats it the same as 301.
Use 302 only when the old URL is coming back, such as a short promotion or a page that is temporarily offline. Google has said all redirect codes pass PageRank, so the real cost of a wrong 302 is that Google may keep showing the old URL in results instead of the new one. Our guide to redirect codes covers the edge cases.
Exact rules, not wildcards
This generator writes one exact rule per line of input. It does not create pattern rules like "send everything under /old-blog/ to /blog/". That is deliberate: a pattern that is slightly too broad can catch URLs you never meant to touch, and those mistakes are hard to spot on a live site. If you do need a folder rule, write it by hand, place it below the exact rules, and test a handful of URLs it should and should not match.
Where to paste the output
Apache (.htaccess)
Back up the file first. Paste the rules near the top of .htaccess in your site root, above WordPress's own "BEGIN WordPress" block if you run WordPress, so your redirects run before the CMS handles the request. Apache reads .htaccess on every request, so changes apply immediately.
Nginx
Paste the lines inside the server block for your HTTPS site, run nginx -t to check the syntax, then reload Nginx. If you have many rules, keep them in a separate file such as redirects.conf and include it from the server block.
Netlify, Cloudflare Pages and Vercel
Save the _redirects output in your publish folder (Netlify) or build output folder (Cloudflare Pages). Cloudflare Pages ignores query-string matches, and the tool warns you when that applies. For Vercel, merge the redirects array into your existing vercel.json rather than replacing the whole file.
WordPress and Shopify without server access
On managed WordPress hosting without .htaccess access, add the same pairs in the Redirection plugin or your SEO plugin's redirect manager. On Shopify, use the URL Redirects screen in the admin, which also accepts a CSV import of old and new paths.
Chains inside your own list
Over several migrations, redirect lists end up with entries like /a to /b and, later, /b to /c. Leave them as they are and visitors to /a take two hops. Turn on "flatten chains" and the generator points /a straight at /c. It only sees chains within the list you paste, though. If your live server already redirects /c somewhere else, or adds an HTTPS or www hop first, check the result with the Redirect Chain Checker after deploying.
Planning redirects for a site migration
Every old URL that had traffic, rankings or backlinks needs a redirect to its closest equivalent new page. Build the list before launch, not after: export your current URLs from your sitemap, analytics and backlink tool, map each one, and generate the rules so they go live with the new site. Send each old page to the most relevant new page rather than the homepage; Google often treats mass redirects to the homepage as soft 404s.
After launch, test a sample of redirects, update internal links to point at the new URLs directly, submit the new sitemap, and watch Search Console for old URLs returning 404. Keep the redirects in place for at least a year, and ideally for good, because old links and bookmarks keep arriving long after the move.