How do you write these redirects for your server?

Paste old and new addresses, one pair per line. You get 301 rules for Apache, nginx, Cloudflare, Netlify and the Redirection plugin for WordPress, with chains, loops, duplicates and query strings flagged before they go live. Nothing leaves your browser.

Put a tab, a comma or a space between the two. Paths such as /old-page or full addresses both work, and a header row is skipped.

Ties the paths to your host. Cloudflare needs it, and it helps find chains between paths and full addresses.


        

What it writes

  • Apache (.htaccess). A Redirect 301 line for each pair, with the old path decoded as mod_alias expects, so a Greek path is written in Greek. Redirect also covers everything below a path, so longer paths come first, and a path ending in / gets an exact RewriteRule from mod_rewrite instead. An old address with a query string gets a RewriteCond and a RewriteRule, which drop the old query string with QSD.
  • nginx. An exact location for each path, location = /old-page, with return 301. Addresses with a query string are compared with $request_uri at server level, which nginx reads before it picks a location.
  • Cloudflare. A Bulk Redirects list in CSV, with no header row, as Cloudflare asks. A list cannot hold a source with a query string, so each of those gets a redirect rule, with its filter expression written out.
  • Netlify. A _redirects file with the old path, the new address and 301 on each line, special characters percent-encoded. An old address on another domain gets a domain-level rule with 301!.
  • Redirection for WordPress. A CSV with the source, the target, 0 for no regular expression and 301, the columns the plugin imports.
  • Checks before anything goes live. Chains, where the new address is redirected again, with the option to send each old address straight to the end; loops; the same old address twice; pairs that point to themselves; query strings and #fragments.

What it does not do

It does not open any address, so it cannot tell whether the new pages exist. Once the rules are live, check them with the redirect checker.

It does not touch your server, and it cannot see the rules you already have, which may catch an address before these do.

A rule for an address with a query string matches those parameters exactly as written. The same parameters in another order, or with utm tags added, are not redirected by it. Redirection is the exception: it matches the parameters in any order.

It writes one 301 rule per address. Rules with wildcards or regular expressions, which move whole folders at once, are not written.

Questions

Should a redirect be 301 or 302?

301 when the page has moved for good. Google says 301 and 308 mean a page has permanently moved, recommends a permanent server-side redirect whenever possible, and advises it when you are sure the redirect will not be reverted. Keep 302 for a move you plan to undo.

Why collapse a chain?

Each step is one more request before a visitor reaches the page, and the old address keeps depending on every rule after it. Pointing each old address straight at the final one removes the extra steps. The redirect checker shows the chains that are already live.

Why is my old address with ?id= not redirected?

Apache's Redirect, an nginx location and a Cloudflare list look at the path only, not the query string. This tool gives those addresses a rule of their own. Check that the parameters are written in the same order as on your site.

Does it work with Greek addresses?

Yes. Apache and nginx compare the decoded path, so the old path is written in Greek. Netlify asks for special characters to be percent-encoded, so there it is written in %CE%... form. You can paste either form.