Free Tool
4.9/5

Free WordPress Redirect Generator

Build 301/302 WordPress redirects as Redirection plugin JSON imports or PHP snippets for functions.php / mu-plugins. Pick the workflow that fits your stack.

JSON file ready to import into the free Redirection plugin (Tools → Redirection → Import). Recommended for non-coders, no PHP edits needed.

How to install

1. Install the free Redirection plugin by John Godley from the WordPress plugin directory.

2. Go to Tools → Redirection. Complete the 2-minute setup wizard if it's your first time.

3. Click the Import/Export tab. Choose Import from JSON, drop in the downloaded file, click Import.

4. Verify rules under Redirects, then test one in an incognito window to confirm.

Need redirects you can edit later without WP-admin?

Point your high-value old URLs at Flyn short links, edit the destination anytime from anywhere, no PHP, no plugin update, no deploy. Track every click by location, device, and referrer. Moving a whole site? Bulk-import your entire redirect map with Flyn's CSV import instead of adding rules one at a time.

Try Flyn free

How to Create WordPress Redirects in 3 Steps

Step 1: Enter your old and new URLs, WordPress Redirect Generator screenshot
1

Enter your old and new URLs

Add rows of source path (old URL) and destination (new URL or external link). Pick 301, 302, or 307 per rule. Add as many rules as you need.

Step 2: Pick your output format, WordPress Redirect Generator screenshot
2

Pick your output format

Toggle between Redirection plugin JSON (easy import, no-code) and PHP snippet for functions.php / mu-plugins (version control, no plugin needed).

Step 3: Install and test, WordPress Redirect Generator screenshot
3

Install and test

For the plugin: download .json, import via Tools → Redirection → Import/Export. For PHP: paste into wp-content/mu-plugins/flyn-redirects.php. Test in incognito.

WordPress Redirects: Plugin vs PHP vs .htaccess

WordPress has three common ways to set up redirects, each with trade-offs:

  • Redirection plugin (recommended for most): a free, well-maintained WP plugin (10M+ active installs). Manage rules from wp-admin, see hit logs, monitor 404s. The JSON output above imports directly. Best for non-developers and most teams.
  • PHP snippet (template_redirect): add a wp_safe_redirect call to functions.php or wp-content/mu-plugins. Lives in your repo, version-controlled, no plugin to keep updated. Best for agencies and developer-managed sites.
  • .htaccess (Apache only): server-level redirects fire before WordPress loads, fastest. But only works on Apache; managed WP hosts often use NGINX. Use our HTAccess Redirect Generator for those.

When to Add a Redirect

The single most common WordPress SEO mistake is leaving 404s on URLs that had backlinks or rankings. Use redirects whenever:

SituationWhy it matters
Renamed a post or page slugWordPress changes the URL, old backlinks now 404 unless you redirect. Add /old-slug → /new-slug.
Restructured your category hierarchyMoving /blog/category-a/post to /blog/category-b/post means every old child URL needs a redirect.
Deleted a post or merged duplicate contentSend the deleted URL to the closest replacement, not the homepage, Google treats homepage-redirects as soft 404s.
HTTPS migrationForce every http:// URL to its https:// equivalent, usually a server-level rule, but PHP fallback works for legacy hosts.
WWW / non-WWW canonicalizationDecide on one (recommended: non-www) and 301 the other to it, site-wide via plugin or a regex rule.
Migrating from another platform to WordPressMap every old Squarespace / Webflow / Shopify URL to its WordPress equivalent BEFORE you launch.

Pro tip

Before any migration, pull the list of pages with backlinks from Search Console → Performance → Pages (or Ahrefs / Semrush). Every URL that has clicks or impressions needs a redirect, losing those is losing real traffic. And when you build those rules, default to 301s; the 301 vs 302 guide explains the rare cases where a 302 is right.

WordPress Redirect Best Practices

Do

Don't

Use 301 (Permanent) for renamed/moved content

Use 302. It does not transfer SEO equity reliably

Redirect old URL → closest replacement

Redirect everything to the homepage (soft 404 risk)

Keep redirects in mu-plugins for version control

Paste into parent theme functions.php (lost on update)

Audit existing 404s in Search Console first

Migrate blindly and lose ranking on backlinked URLs

Test every important redirect in incognito

Trust the WP cache to show fresh behavior

Use Flyn for redirects you may need to edit later

Hardcode marketing-campaign destinations

Edit Redirects Without Touching wp-admin

Edit destinations on the fly

Point a Flyn link at any new destination from anywhere, no PHP edit, no plugin update, no WP login required.

Real per-link analytics

See clicks by country, device, referrer, hour. The Redirection plugin only logs hits, Flyn shows you who and from where.

Branded short URLs

go.yourbrand.com/launch instead of /lp-2026-spring. Cleaner in emails, printable on flyers, memorable in ads.

Stop hardcoding marketing URLs

Use Flyn for campaign destinations, keep WP redirects for the structural site moves, where they belong.

Frequently Asked Questions

What does this WordPress redirect generator output?
Two formats. (1) A JSON file ready to import into the free Redirection plugin via Tools → Redirection → Import/Export, the no-code path. (2) A PHP snippet for functions.php or wp-content/mu-plugins that hooks into template_redirect and runs wp_safe_redirect(), the code-in-version-control path. Pick whichever matches your team's workflow.
Why not just edit my .htaccess file?
You can, and on traditional LAMP hosts that is the fastest route (use our HTAccess Redirect Generator instead). But managed WordPress hosts (Kinsta, WP Engine, Pressable, Pantheon) often disable .htaccess or use NGINX. PHP-based redirects via Redirection plugin or wp_safe_redirect work on every host, integrate with the WP admin, and survive theme changes.
Which method is better, Redirection plugin or PHP snippet?
For non-developers and most small sites: the Redirection plugin (JSON import). Easy to manage from wp-admin, logs every hit, has a built-in 404 monitor, and one-click toggles. For agencies, version-controlled sites, and managed-hosting where you cannot install plugins: the PHP snippet in wp-content/mu-plugins/, auto-loads, no activation needed, lives in your repo.
Should I use 301 or 302 for moved WordPress posts?
301 (Permanent) for nearly everything: renamed slugs, restructured categories, deleted posts pointed to replacement content, http → https migrations. Use 302 (Temporary) only for genuinely short-term redirects: maintenance pages, region-based A/B tests, holiday landing pages. The wrong choice hurts SEO, 302s do not transfer link equity reliably and can confuse Googlebot.
How do I avoid redirect chains when restructuring permalinks?
After importing the new redirects, run our Redirect Checker on any URL pointing through more than one hop. WordPress sometimes auto-creates "attachment redirects" or canonical redirects (slug normalization) that stack on top of your manual rules. Use one of the two outputs above, disable WP's native canonical redirect for those specific slugs if needed, and verify you land in a single hop.
Will redirects work for posts that no longer exist?
Yes, that is the main use case. WordPress would normally return a 404 (or, with some themes, a soft 404 page) for a deleted post. The Redirection plugin / template_redirect hook fires before WP serves the 404, so your visitor and Googlebot land on the new URL with a proper 301 status. This preserves the backlinks and search ranking of the old URL.
Can I redirect an entire old category or tag to a new one?
Yes, but you need regex or wildcard matching for that, which keeps things sane at scale. The Redirection plugin (JSON output above) supports per-rule regex if you toggle it manually after import. For one-off bulk category moves, list each child URL explicitly, easier to debug. For a few hundred URLs, regex is faster. For an entire site move, use our HTAccess Redirect Generator (server-level is faster).
Will these redirects survive a theme update?
Yes for both methods. The Redirection plugin stores rules in the database, completely independent of your theme. The PHP snippet method survives if you put it in wp-content/mu-plugins/ (must-use plugins auto-load, theme-independent) OR in a child theme functions.php. Never paste redirect code in your parent theme, it will be overwritten on every theme update.
How do I handle WordPress trailing-slash differences?
WP normalizes /post and /post/ to the same canonical URL by default. The PHP snippet above checks both /old-page and /old-page/ for safety. The Redirection plugin matches the URL as you enter it, so if you enter /old-page without the slash, the plugin will not match /old-page/ unless you toggle the "ignore trailing slash" option in the plugin settings.
Do these redirects affect SEO ranking?
Done right: yes, positively. A 301 transfers between 90-99% of the old URL's link equity to the new one. Done wrong (302s, redirect chains, missing redirects for important URLs), you lose ranking entirely on the old URLs. The single biggest WordPress SEO mistake on migrations is leaving 404s on URLs that have backlinks, always check Google Search Console for old URLs with traffic before you migrate.
How many redirects can WordPress handle?
The Redirection plugin handles tens of thousands without measurable performance impact (rules are indexed in the DB). The PHP snippet above uses a simple PHP array, fine up to a few hundred rules; past that, switch to the plugin or to server-level redirects (.htaccess / nginx). For 10K+ redirects on a high-traffic site, server-level is the only sensible answer.
Can I track which old URLs are still getting hit?
The Redirection plugin logs every hit by default, see Tools → Redirection → Logs. For deeper analytics (geo, device, referrer per redirect), point your old URLs at a Flyn short link and let Flyn track. Most teams use both: Redirection for the WP integration, Flyn for high-priority redirects that need real attribution and editable destinations without a WP login.

Stop losing traffic on old URLs

WordPress redirects keep your backlinks and rankings intact during migrations. Flyn keeps your marketing URLs editable forever, with per-click analytics on every campaign.