SEO Tools
301 Redirect Rule Generator
Turn a list of old and new URLs into 301, 302, 307 or 308 redirects for Nginx, Apache .htaccess, Cloudflare Bulk Redirects CSV and _redirects files.
How to use 301 Redirect Rule Generator
Enter one redirect per line: the old path, the new path or URL and an optional status code. Choose a default status, the output format and whether to keep the query string. The rules update as you type.
- List old and new addressesWrite /old-page /new-page on each line, or paste two spreadsheet columns; add 302, 307 or 308 to override.
- Choose status and formatPick the default status code, one output or all formats, and your domain for the Cloudflare rows.
- Add the rules to your sitePaste them into the Nginx server block, .htaccess, a Cloudflare list or _redirects, then test a few old URLs.
301, 302, 307 or 308?
Use 301 for a permanent move, such as a renamed page or a site migration; search engines take it as a strong signal to index the new URL instead. 302 is a temporary redirect for short-lived changes like a promotion. 307 and 308 are the temporary and permanent equivalents that keep the request method, so a form POST stays a POST, which matters for APIs and form handlers. Each line can override the default status by adding the code at the end, for example /promo https://shop.example.com/sale 302.
Exact matching, query strings and loops
Every rule matches one exact path: /old does not match /old/ or /old/abc, so list both forms if your site serves them. An old address can be a full URL to limit the rule to one host; Nginx output then notes which server block to use and Apache adds a RewriteCond on the host. Old addresses with a ?query are skipped because these rules match paths only. With the query-string option on, parameters such as ?utm_source=… carry over to the target; with it off, Apache rules get the QSD flag to drop them. Lines that would redirect to themselves, and duplicate old paths, are skipped.
Accuracy and data handling
Generated tags and rules must match the real page content and the site's deployment environment. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I create a 301 redirect in .htaccess?
Choose Apache output and enter the old and new paths. Each line becomes a rule such as RewriteRule ^/?old-page$ /new-page [R=301,L] after RewriteEngine On; mod_rewrite must be enabled.
How do I add redirects in Nginx?
Choose Nginx output. Each redirect becomes an exact-match location block containing a return 301 line, which goes inside your site's server block. Reload Nginx afterwards with nginx -s reload.
Can I import the redirects into Cloudflare?
Yes. Choose Cloudflare Bulk Redirects CSV, set your domain and import the file into a Bulk Redirect list. The columns cover source, target, status and the query string, subdomain, subpath and path suffix options.
Does it work for Netlify?
Yes. The Cloudflare Pages / Netlify output writes the old path, target and status on each line; save it as a file named _redirects in your published folder.
More SEO Tools
Related toolsPull hostnames and root domains from URL lists, with counts and de-duplication
Extract all URLs from sitemap XML as a list, table or CSV
Test which URLs a robots.txt allows or blocks for a given crawler
Check URL length, parameters and tracking tags, and get a cleaner version
Turn letters or an emoji into favicon.ico, SVG and PNG icons with head code
Generate robots.txt rules, a sitemap line and AI crawler blocks as you type.