Bulk redirects for WordPress, done right
Changing permalinks, merging posts, migrating from another CMS or restructuring a shop all leave old URLs behind. Without redirects, every bookmark, backlink and search result pointing to them becomes a 404 and the ranking signals they earned are lost. A 301 tells browsers and search engines the move is permanent and passes those signals to the new URL.
This generator takes a plain list — one old new pair per line, separated by spaces, tabs or commas — and converts it into rules for the layer that should handle them. Server rules (Apache .htaccess or Nginx) run before PHP and WordPress load, so they are the fastest. The PHP output hooks template_redirect and is ideal on managed hosts where you cannot edit server config.
Every line is validated. Malformed lines, duplicate sources and redirects that point to themselves are skipped with a clear message; chains (A → B → C) are detected and can be flattened so each old URL needs a single hop; loops are removed before they reach your server.
How to use the WordPress Redirect Generator
- Paste your redirects, one per line. Old URLs can be full URLs or paths; an optional third column overrides the status code.
- Choose the default status:
301/308for permanent moves,302/307for temporary ones. - Review the issues table. Fix errors, and keep Flatten redirect chains on unless you need intermediate hops.
- Choose the output — Apache, Nginx, PHP or CSV — then copy or download it.
- Test a few old URLs with your browser’s network panel or
curl -Iand confirm a single 301 to the right destination.
Example
The input /index.php?page_id=12 /about/ needs mod_rewrite, because Redirect cannot see query strings:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^page_id=12$
RewriteRule ^index\.php/?$ /about/? [R=301,L]
</IfModule>Choosing the right output
- Apache Redirect (mod_alias) is the simplest, but it matches prefixes:
Redirect 301 /blog /newsalso sends/blog/postto/news/post. Switch to RewriteRule for exact matches. - Query strings cannot be matched by
Redirector Nginxlocation. The tool usesRewriteCond %{QUERY_STRING}for Apache and amap $request_uriblock for Nginx, and drops the old query from the target with a trailing?. - PHP is portable and survives host migrations. It uses
wp_safe_redirect(), which only allows your own domain by default — external hosts found in your list are added toallowed_redirect_hostsautomatically. - CSV (
source,target,code) is handy for audits in a spreadsheet or for redirect plugins that import CSV files.
Redirect hygiene
Keep server-level redirects above # BEGIN WordPress — the .htaccess Generator explains the structure. Redirect to the final canonical URL (correct scheme, host and trailing slash) to avoid extra hops; the Canonical URL Generator helps you settle on one format. Do not block redirected URLs in robots.txt, or crawlers will never see the 301 — see the robots.txt Generator and the WordPress redirects guide.
Frequently Asked Questions
301 or 302 — which should I use?
Use 301 (or 308) when the move is permanent; search engines transfer ranking signals and update their index. Use 302 (or 307) for temporary situations such as maintenance or A/B tests. 307 and 308 also guarantee the request method is preserved, which matters for form posts.
Can I paste full URLs instead of paths?
Yes. The source is reduced to its path and query string. Targets on other domains stay absolute; add your domain in the optional field so absolute URLs on your own site are treated as internal for chain detection.
What is a redirect chain and why flatten it?
A chain is when A redirects to B and B redirects to C. Each hop adds latency and Google follows only a limited number of hops. Flattening rewrites A to point straight to C.
Where do I put Nginx redirects?
Inside the server { } block for your site, before the location / block that passes requests to WordPress. Query-string map blocks go in the http { } context. Test with nginx -t before reloading.
Should I use a redirect plugin instead?
Plugins are convenient for editors and log 404s. For large lists, migrations and performance, server rules are better because they run before WordPress loads. The PHP output sits in between: no plugin, but still portable.