Skip to main content
SEO March 28, 2026 · 6 min read

Mastering WordPress 301 Redirects: A Complete Guide

Redirects are a critical tool for any WordPress developer. Whether you're moving a site, changing a URL structure, or fixing broken links, 301 redirects ensure your SEO juice stays intact.

TL;DR

  • Why 301 Redirects are Essential
  • Implementing Redirects via .htaccess
  • PHP-Based Redirects in WordPress

Why 301 Redirects are Essential

A 301 redirect tells search engines that a page has permanently moved to a new location. Without them, users hitting an old URL see a 404 error, and search engines lose the "link juice" accumulated over time. When done correctly, a 301 redirect passes nearly 100% of the original page's authority to the new one.

Implementing Redirects via .htaccess

For Apache servers, the .htaccess file is the most efficient place to manage redirects. It happens before WordPress even initializes, making it lightning-fast.

# Redirect a single page
Redirect 301 /old-page https://yoursite.com/new-page

# Redirect an entire site to a new domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301,NC]

Pro Tip: Use the 301 Redirect Rule Generator to build complex regex rules without the headache.

PHP-Based Redirects in WordPress

Sometimes you need dynamic logic for a redirect. In these cases, using WordPress's wp_redirect() function is appropriate.

add_action('template_redirect', function() {
    if (is_page('old-slug')) {
        wp_redirect('https://yoursite.com/new-slug', 301);
        exit;
    }
});

Frequently Asked Questions

What is the difference between 301 and 302 redirects?
A 301 redirect is a permanent move that passes nearly all SEO equity (link juice) to the new URL. A 302 redirect is temporary and does not pass SEO power; it should only be used for short-term testing or maintenance.
Should I use a plugin for redirects in WordPress?
While plugins like 'Redirection' are user-friendly, implementing redirects via .htaccess is significantly faster as it happens at the server level before WordPress even loads, reducing server load and improving page speed.
Can a 301 redirect hurt my SEO?
Correctly implemented 301 redirects actually protect your SEO by ensuring users and search engines find the new location of your content. However, internal redirect chains (A -> B -> C) should be avoided as they slow down crawling.

Key Takeaways

  • Why 301 Redirects are Essential: Practical action you can apply now.
  • Implementing Redirects via .htaccess: Practical action you can apply now.
  • PHP-Based Redirects in WordPress: Practical action you can apply now.