How to Set Up Redirects in WordPress: 301, 302, and Regex Redirects Explained

Whether you’re migrating a site, restructuring URLs, or simply fixing broken links, WordPress redirects are one of the most important tools in your SEO toolkit. A well-configured redirect preserves your link equity, keeps visitors happy, and helps search engines understand your site structure.

In this practical guide, we’ll break down the different types of redirects, explain when to use each one, and show you exactly how to implement them in WordPress, both with plugins and directly via the .htaccess file.

What Are WordPress Redirects?

A redirect is a server-side instruction that automatically sends visitors (and search engine crawlers) from one URL to another. When someone clicks a link or types a URL that has been redirected, the browser is told to load a different page instead.

Redirects are essential when:

  • You change a post or page URL (slug)
  • You migrate your site to a new domain
  • You delete content and want to point users to a relevant alternative
  • You merge two pages into one
  • You want to fix 404 errors discovered in Google Search Console
url redirect arrows

The Main Types of Redirects Explained

Not all redirects are created equal. Choosing the wrong one can hurt your rankings or confuse search engines. Here’s a quick comparison:

Redirect Type Meaning SEO Impact Best Use Case
301 Permanent Passes ~99% of link equity Permanent URL changes, migrations
302 Temporary No equity transfer (URL stays indexed) A/B tests, temporary promotions
307 Temporary (HTTP/1.1) Similar to 302 Preserves request method (POST data)
410 Gone Tells Google to deindex Permanently removed content
Regex Pattern-based Depends on rule (301/302) Bulk redirects, URL pattern changes

When to Use a 301 Redirect

Use a 301 redirect when the change is permanent. This is the most common redirect type for SEO because it transfers nearly all of the original URL’s ranking power to the new URL. Examples: changing a slug from /old-product/ to /new-product/, or moving from HTTP to HTTPS.

When to Use a 302 Redirect

Use a 302 redirect only when the change is temporary. Search engines will keep the original URL indexed, expecting it to come back. A good example is redirecting a product page to a “sold out” notice while you restock.

When to Use Regex Redirects

Regex (regular expression) redirects let you handle multiple URLs at once with a single rule. They’re powerful when:

  • You’re migrating an entire folder structure (e.g., /blog/2023/post-name to /post-name)
  • You changed your permalink structure
  • You need to redirect query strings or dynamic parameters
url redirect arrows

Method 1: Setting Up WordPress Redirects With a Plugin

If you’re not comfortable editing server files, a plugin is the safest route. Here are the top options in 2026:

  • Redirection (free) – the most popular dedicated redirect manager
  • SEOPress – integrates redirects inside a full SEO suite
  • Rank Math – includes a built-in redirection module
  • Yoast SEO Premium – automatic redirects when you change slugs

Step-by-Step With the Redirection Plugin

  1. Go to Plugins > Add New and search for “Redirection”
  2. Install and activate the plugin by John Godley
  3. Navigate to Tools > Redirection and complete the setup wizard
  4. Click Add new redirection
  5. Enter the Source URL (the old URL)
  6. Enter the Target URL (the new destination)
  7. Choose your HTTP code (usually 301)
  8. Click Add Redirect

The plugin also tracks 404 errors automatically, making it easy to spot broken links and create redirects on the fly.

Creating Regex Redirects in the Redirection Plugin

When adding a new rule, click the gear icon and check the Regex option. For example, to redirect all old dated blog URLs to clean slugs:

  • Source URL: ^/blog/\d{4}/\d{2}/(.*)$
  • Target URL: /$1

This single rule handles thousands of URLs at once.

Method 2: Setting Up Redirects via .htaccess

For Apache servers (the most common WordPress hosting environment), you can add redirects directly in the .htaccess file. This is the fastest method because it works at the server level, before WordPress even loads.

How to Edit .htaccess Safely

  1. Connect to your site via FTP or your hosting File Manager
  2. Locate the .htaccess file in your WordPress root folder
  3. Make a backup before editing anything
  4. Add your rules above the # BEGIN WordPress line

Basic 301 Redirect

Redirect 301 /old-page/ https://example.com/new-page/

302 Temporary Redirect

Redirect 302 /promo/ https://example.com/summer-sale/

Redirect an Entire Domain

RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule (.*)$ https://newdomain.com/$1 [R=301,L]

Regex Redirect Example

RewriteEngine On
RewriteRule ^blog/([0-9]{4})/([0-9]{2})/(.*)$ /$3 [R=301,L]
url redirect arrows

Common Redirect Scenarios in WordPress

1. Post-Migration Redirects

After migrating to a new domain or restructuring URLs, export your old URL list and map every important page to its new location. Bulk import the list into the Redirection plugin’s Import/Export tool, or build a regex pattern if the URLs follow a consistent structure.

2. Fixing Broken Links (404 Errors)

Check Google Search Console under Pages > Not Found (404). For each broken URL with backlinks or traffic, set up a 301 redirect to the most relevant existing page. Don’t redirect everything to the homepage as Google may treat these as soft 404s.

3. HTTPS Migration

If you recently moved from HTTP to HTTPS, force the secure version with this .htaccess rule:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

4. Trailing Slash Consistency

Decide whether your URLs end with a slash or not, then enforce it. Mixed signals can create duplicate content issues.

Best Practices for WordPress Redirects

  • Avoid redirect chains: don’t redirect A to B to C. Always point directly to the final URL.
  • Audit redirects regularly: outdated rules slow your site down.
  • Use 301 by default for any permanent change.
  • Match user intent: redirect to a page with similar content, not just any page.
  • Test before deploying: use tools like httpstatus.io to verify status codes.
  • Monitor performance: too many redirects on one server can impact page speed.
url redirect arrows

Plugin vs .htaccess: Which One Should You Choose?

Criteria Plugin .htaccess
Ease of use Very easy Requires technical skills
Speed Slower (PHP processing) Fastest (server-level)
404 tracking Yes No
Risk of breaking site Low Higher
Best for Most users Developers, high-traffic sites

FAQ About WordPress Redirects

Do WordPress redirects hurt SEO?

No, when used properly. 301 redirects pass nearly all link equity to the new URL. Problems arise only with redirect chains, redirect loops, or redirecting to irrelevant pages.

How many redirects is too many?

There’s no strict limit, but each redirect adds processing time. If you have thousands of plugin-based redirects, consider moving them to .htaccess or your server config for better performance.

Can I redirect a single WordPress page without a plugin?

Yes. You can add a rule to your .htaccess file, use the wp_redirect() function in your theme, or change the page slug and rely on WordPress’s built-in slug redirection.

What’s the difference between a 301 and a canonical tag?

A 301 actually sends users and bots to a new URL. A canonical tag is a hint to search engines about the preferred version of a page, but users still access the original URL. Use 301 for moves, canonicals for duplicate content management.

How long do I need to keep redirects in place?

Google recommends keeping 301 redirects for at least one year. In practice, leave them indefinitely if the redirected URL still receives traffic or has backlinks.

Why isn’t my WordPress redirect working?

Common causes include caching (clear your cache plugin and CDN), conflicting plugins, incorrect URL formats, or browser cache. Test in an incognito window first.

Final Thoughts

Mastering WordPress redirects is essential for anyone serious about SEO and user experience. Use 301s for permanent changes, 302s for temporary ones, and regex when you need to handle patterns at scale. Whether you prefer the convenience of plugins like Redirection or the raw speed of .htaccess, the most important thing is to plan your redirect strategy carefully, especially during migrations or major site updates.

Start by auditing your current 404 errors today, set up the right redirects, and watch your SEO health improve over the coming weeks.

Recent Posts

No Posts Found!

Categories

Tags

    Subscribe

    You have been successfully Subscribed! Ops! Something went wrong, please try again.

    About Us

    Express Jam Studio was founded in 2004 by John Smith. John had previously worked for a courier company, but he saw an opportunity to start his own business in the web design and development industry.

    Contact Info

    Copyright © 2022 Express Jam Studio. All Rights Reserved.