Bulk 301 redirect generator for Apache and Nginx
A site move or a URL change needs hundreds of redirects, and one wrong line can create a loop. Generate the rules from your mapping and check them before you deploy.
Opens up to 50 old URLs after the rules are live and compares where they really lead with the map. Relative paths need the domain field.
Online checks send only the address to the IndexFix Tools server, which downloads that public page and passes the answer back. Nothing is stored.
Your data stays in your browser. Nothing is uploaded or stored.
Key facts
- Google recommends permanent server-side redirects, such as 301 and 308, when URLs change.
- Redirect to the final destination directly; if chains can't be avoided, keep them ideally to no more than 3 and fewer than 5 hops.
- Google's crawlers follow up to 10 redirect hops; 301 and 308 are strong signals, 302 and 307 weak ones.
- Keep redirects for as long as possible, generally at least 1 year.
Download the checklist: diagnosing indexing problems
Step by step: status in Search Console, page availability, robots.txt, noindex, canonical URL, redirects, sitemap and backlinks, with what to do in each case.
Download PDF PDF · 2 pagesHow to use it
- Prepare the mapping: one old URL and its new URL per line, separated by a comma, tab or arrow.
- Paste it or choose a CSV file, and enter the site host if the old URLs are full addresses.
- Choose the server (Apache, Nginx or both) and the status code.
- Click Generate rules and fix everything in “Check these first”.
- Copy or download the rules, test them on a staging server, then deploy.
Where to get the data
A crawl of the old site
The full list of old URLs, including those with parameters.
Old sitemaps and analytics
Old sitemap files and the most visited pages, so important URLs aren't missed.
Your mapping spreadsheet
Two columns, old and new, exported as CSV.
Exact matches on Apache
Apache's Redirect directive matches by prefix, so a rule for /old also catches /old-page. The generator uses RedirectMatch with ^ and $ for exact matches. URLs with a query string need mod_rewrite, so those rows get RewriteCond and RewriteRule lines with the QSD flag, which drops the old query string (Apache 2.4 and later).
Nginx with a map
For Nginx the generator writes a map on $request_uri, which includes the query string, and one if block that returns the redirect. The map goes in the http context and the if block in the server block.
Chains and loops
If a new URL is itself redirected further on in the list, the old URL is pointed straight at the final target. A loop, where URLs redirect back to each other, is left out and listed so you can fix the mapping.
Next step
After deploying, go through the post-migration SEO checklist.
Questions and answers
301 or 308?
Both are permanent redirects and Google treats them the same way. 308 also tells clients to keep the request method.
Does it support patterns or wildcards?
No. It writes exact one-to-one rules, which are the safest choice for a URL map.
What about old URLs on another domain?
Enter the old site's host; rows whose old URL is on a different host are skipped and listed.
How long should the redirects stay?
Google suggests generally at least one year, and longer if possible.
Sources
- Site moves with URL changes — Google Search Central: https://developers.google.com/search/docs/crawling-indexing/site-move-with-url-changes
- How HTTP status codes and network errors affect Google Search — Google Search Central: https://developers.google.com/search/docs/crawling-indexing/http-network-errors
- mod_alias — Apache HTTP Server documentation: https://httpd.apache.org/docs/2.4/mod/mod_alias.html
- ngx_http_map_module — nginx documentation: https://nginx.org/en/docs/http/ngx_http_map_module.html