Redirect & Canonical Snippet Generator
Turn a list of old and new URLs into ready-to-paste 301 redirect and rel=canonical snippets for Apache, Nginx, Netlify, Cloudflare, Vercel, Next.js and IIS.
Generated snippet
Add one redirect per line above to see the snippet instantly.
Exact-path redirects only. Wildcards, splats and regex patterns are not
generated: a * or :slug inside a path is escaped and matched
literally.
How it works
Type a redirect map (a source path, whitespace, a destination, and an optional status code) and the matching server snippet is written as you type. The status codes follow RFC 9110 section 15.4: 301 Moved Permanently and 308 Permanent Redirect are the two that consolidate ranking signals on the new URL, 302 Found and 307 Temporary Redirect say "keep the old URL indexed", and 303 See Other turns a POST into a GET. The difference inside each pair is method rewriting: clients have always been allowed to turn a POST into a GET on 301 and 302, while 307 and 308 guarantee the method and body survive.
The optional canonical output uses the Link header field defined in
RFC 8288 with the canonical relation type registered by
RFC 6596, which is the HTTP equivalent of
<link rel="canonical"> and the only way to mark a canonical on a PDF or an
image. Each platform gets its own dialect: Apache 2.4 RewriteRule plus
<If> blocks, exact-match Nginx location = blocks with
return, the Netlify and Cloudflare Pages _redirects and
_headers plain-text formats, a vercel.json, a Next.js
redirects() and headers() config, an IIS URL Rewrite
web.config, or a client-side HTML meta refresh.
Two caveats worth stating plainly. Vercel and Next.js express 308 as
permanent: true and 307 as permanent: false, so 301, 302 and 303 are
emitted as an explicit statusCode instead. IIS URL Rewrite has no 308
redirectType, so a 308 falls back to Permanent (301) and the snippet
carries a comment saying so. Everything is generated in JavaScript on your device, so no URL,
path or hostname you type is ever uploaded.
Frequently asked questions
How do I generate a 301 redirect snippet?
Type one redirect per line as an old path, some whitespace, the new path, and an optional status code, for example "/old-page /new-page 301". Pick your server or host from the dropdown and the snippet is written as you type, with no button to press. Lines that leave the status code off use the default you pick in the Default status code menu, so you can paste a two-column list from a spreadsheet and set 301 once for the whole batch. Then use Copy snippet or Download.
What is the difference between a 301 and a 308 redirect?
Both say the move is permanent and both pass ranking signals to the new URL. The difference is method rewriting, as defined in RFC 9110 section 15.4: clients have always been allowed to turn a POST into a GET when they follow a 301, while a 308 Permanent Redirect guarantees the request method and body survive. The same split applies to the temporary pair, where 302 Found allows the rewrite and 307 Temporary Redirect forbids it. Use 301 for ordinary page moves and 308 when the URL also serves form or API traffic. Note that Vercel and Next.js express 308 as permanent:true and 307 as permanent:false, and IIS URL Rewrite has no 308 option at all, so the generator falls back to 301 there and adds a comment saying so.
Can I set a canonical URL without editing the HTML?
Yes. Fill in the optional Canonical URL field and the snippet gains a Link HTTP header for the same platform, using the header field defined in RFC 8288 with the canonical relation type registered by RFC 6596. That header does exactly what a link rel=canonical tag does, and it is the only way to mark a canonical on a file that has no head section, such as a PDF or an image. Everything is built in JavaScript on your device, so the URLs, paths and hostnames you type are never uploaded.