Choosing the status code
The tool offers the two codes most people need. Others are listed for context.
| Code | Meaning | Method preserved? | Typical SEO use |
|---|---|---|---|
| 301 | Moved permanently | Clients may switch POST to GET | Site migrations, URL changes, HTTPS and www canonicalisation |
| 302 | Found (temporary) | Clients may switch POST to GET | Short-lived moves, A/B tests, maintenance pages |
| 307 | Temporary redirect | Yes | Temporary move for API or form traffic |
| 308 | Permanent redirect | Yes | Permanent move for API or form traffic |
Search engines treat 301 and 308 as signals to index the new URL, and Google has said that ranking signals pass through redirects generally. A 302 usually keeps the old URL indexed, though a long-lived 302 may eventually be treated as permanent. Use 307 or 308 only when you must preserve the request method; the dropdown here has just 301 and 302, so edit the code in the output by hand if you need them.
What the generated rules look like
Enter one pair per line, separated by spaces, tabs or a comma. Lines with no target are ignored. For the pair /old-page /new-page with 301, Apache output is Redirect 301 /old-page /new-page and nginx output is location = /old-page { return 301 /new-page; }.
Force www asks for your domain without the www (for example example.com), because the rule must name the exact host it applies to. With Force HTTPS and Force www both ticked and that domain entered, the Apache block is:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The generated block also contains comment lines, including a commented X-Forwarded-Proto condition (see the pitfalls). The apex rule comes first and always points at the final HTTPS www address, so every visitor gets at most one redirect: http://example.com, https://example.com and http://www.example.com each go straight to https://www.example.com. For nginx, the whole-site rules are written as separate server blocks instead of if lines: a listen 80 block that returns a 301 to the final HTTPS address, and, when www is forced as well, a listen 443 ssl block for the bare domain that redirects to www (you add the certificate paths it asks for). Your individual location redirects are listed separately, to paste inside your existing server block.
Pitfalls
- Prefix versus exact matching. Apache's
Redirectmatches a path prefix, so/oldalso catches/old/pageand appends the rest. Nginxlocation =matches that exact path only. - Redirect chains. The generated Force HTTPS and Force www rules are ordered so a request takes one hop, not two. Redirects you add from other places (a CDN setting, your application, a plugin) can still add hops, so test the real chain.
- The www rule is for one domain. It only matches the exact domain you enter, so subdomains such as
blog.example.comare left alone. The bare domain and the www host are the only two names it touches. - Behind a proxy or CDN. If TLS ends at a load balancer, CDN or reverse proxy, your server only sees plain HTTP and cannot tell which requests were HTTPS, so a plain "is this HTTPS" test redirects forever. Test the
X-Forwarded-Protoheader instead (the Apache output includes the commented condition; in nginx use$http_x_forwarded_proto), or do the HTTPS redirect at the proxy and leave it out here. - Placement. Apache rules go in
.htaccessor the virtual host, with mod_alias and mod_rewrite enabled. In nginx, thelocationlines belong inside your existingserverblock, while the generated whole-siteserverblocks go at the same level as your other servers, followed by a reload. - Query strings. Nginx
returndoes not append the original query string unless you add$is_args$args.
After deploying, confirm each hop with the HTTP headers checker, and keep the robots.txt generator output free of blocked redirect targets.