WP AI Agent
Features Pricing Blog Contact Download Plugin Manage Subscription Get Free Key →

How to Redirect a Page in WordPress: The Complete Guide

· · 8 min read

Knowing how to redirect a page in WordPress is one of the most essential skills for any site owner, whether you are fixing a broken link, restructuring your content, or migrating to a new domain. A redirect tells both browsers and search engines that a URL has moved, ensuring visitors always land on the right page and your hard-earned SEO value is preserved.

Why Redirects Matter for WordPress Sites

Before diving into the methods, it is worth understanding why redirects are so important. When you delete a page, change a slug, or move content to a new URL, anyone who tries to visit the old address will hit a 404 error. That is bad for user experience and even worse for SEO, because search engines may penalise pages that return 404 errors repeatedly.

Redirects solve this problem elegantly. The most common types are:

  • 301 Redirect (Permanent): Tells search engines the page has moved permanently. Almost all link equity (ranking power) is passed to the new URL. Use this for most situations.
  • 302 Redirect (Temporary): Signals that the move is temporary. Search engines continue to index the original URL. Use sparingly, such as during A/B tests or temporary maintenance pages.
  • 307 Redirect: The HTTP/1.1 equivalent of 302. Useful in specific technical scenarios but rarely needed in standard WordPress management.

Method 1: Using a WordPress Redirect Plugin

For most WordPress users, a plugin is the easiest and safest way to manage redirects. No code editing is required, and many plugins offer traffic logs so you can see how often redirects are triggered.

Using Redirection (Free Plugin)

Redirection by John Godley is the most popular free redirect plugin with over two million active installs.

  1. Log in to your WordPress dashboard.
  2. Navigate to Plugins > Add New and search for Redirection.
  3. Click Install Now and then Activate.
  4. Go to Tools > Redirection and complete the setup wizard.
  5. Under the Redirects tab, click Add New.
  6. In the Source URL field, enter the old page path (e.g., /old-page/).
  7. In the Target URL field, enter the new destination URL.
  8. Set the HTTP Code to 301 for a permanent redirect.
  9. Click Add Redirect to save.

The plugin also automatically detects when you change a post or page slug and offers to create a redirect for you, which is a huge time-saver.

Using Rank Math or Yoast SEO

If you are already using an SEO plugin, you may not need a separate redirect plugin. Both Rank Math and Yoast SEO Premium include built-in redirect managers accessible from their plugin menus. The workflow is similar: enter the old URL, enter the new URL, choose the redirect type, and save.

Method 2: Adding Redirects via .htaccess

If your WordPress site runs on an Apache web server, you can add redirects directly to the .htaccess file in your site's root directory. This method is faster than plugins because the redirect is handled at the server level before WordPress even loads.

Accessing and Editing .htaccess

  1. Connect to your server via FTP (using FileZilla or similar) or open your hosting control panel's File Manager.
  2. Navigate to the root directory of your WordPress installation (usually public_html or www).
  3. Locate the .htaccess file. If you cannot see it, enable hidden files in your FTP client.
  4. Download a backup copy of the file before making any changes.
  5. Open the file in a text editor.
  6. Add your redirect rule above the # BEGIN WordPress block.
  7. Save the file and re-upload it to your server.

Example .htaccess Redirect Rules

# Single page 301 redirect
Redirect 301 /old-page/ https://www.yoursite.com/new-page/

# Redirect an entire old directory to a new location
Redirect 301 /old-category/ https://www.yoursite.com/new-category/

# Redirect old domain to new domain (add after RewriteEngine On)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldsite\.com$ [NC]
RewriteRule ^(.*)$ https://newsite.com/$1 [R=301,L]

Important: Always back up your .htaccess file before editing. A syntax error can take your entire website offline.

Method 3: Redirects Using PHP in functions.php

You can also add redirects programmatically using PHP. This approach is useful for conditional redirects — for example, redirecting users based on their login status, role, or geographic location.

Adding a Simple PHP Redirect

Add the following snippet to your theme's functions.php file or, better yet, to a custom site-specific plugin to avoid losing the code when you update your theme:

<?php
// Redirect old page to new page
function my_custom_redirect() {
    if ( is_page( 'old-page-slug' ) ) {
        wp_redirect( home_url( '/new-page-slug/' ), 301 );
        exit;
    }
}
add_action( 'template_redirect', 'my_custom_redirect' );

Key points about this approach:

  • Use the template_redirect hook so WordPress has already determined which page is being loaded before your redirect fires.
  • Always call exit; after wp_redirect() to stop further PHP execution.
  • Pass 301 as the second argument to wp_redirect() for a permanent redirect.
  • Consider using a child theme or a must-use plugin to store this code safely.

Conditional Redirect Based on User Role

<?php
// Redirect subscribers away from the dashboard
function redirect_subscribers_from_dashboard() {
    if ( is_admin() && ! current_user_can( 'edit_posts' ) && ! wp_doing_ajax() ) {
        wp_redirect( home_url() );
        exit;
    }
}
add_action( 'admin_init', 'redirect_subscribers_from_dashboard' );

Method 4: Using WP-CLI to Create Redirects

For developers and power users who manage WordPress from the command line, WP-CLI offers a fast way to handle redirects — especially when you need to create dozens of them at once. If you have the Redirection plugin installed, you can use its WP-CLI integration.

WP-CLI Commands for Redirects

# List all existing redirects managed by the Redirection plugin
wp redirection list

# Add a new 301 redirect
wp redirection add --url="/old-page/" --action-url="/new-page/" --http-code=301

# Import redirects from a CSV file
wp redirection import redirects.csv

# Delete a redirect by ID
wp redirection delete 42

Using WP-CLI is particularly powerful when migrating a site and you have a spreadsheet of hundreds of old URLs that all need to point to new destinations. You can script the imports rather than entering them manually through the admin interface.

Best Practices for Managing WordPress Redirects

Having the ability to create redirects is only half the battle. Managing them responsibly keeps your site fast and your SEO healthy.

Avoid Redirect Chains

A redirect chain occurs when URL A redirects to URL B, which redirects to URL C. Each hop in the chain adds latency and dilutes link equity. Always redirect directly to the final destination URL. Audit your redirects periodically using a tool like Screaming Frog or the Redirection plugin's built-in log.

Choose the Right Redirect Type

Use 301 for permanent moves (content restructuring, domain migrations, slug changes). Use 302 only when the original URL will genuinely return in the future. Misusing 302 redirects can cause search engines to continue crawling and indexing the old URL instead of the new one.

Test Every Redirect After Creation

  • Open your browser in incognito mode and visit the old URL to confirm it lands on the correct new page.
  • Use an HTTP header checker tool (such as httpstatus.io) to verify the response code is exactly what you intended.
  • Check Google Search Console a few days later to confirm search engines are following the redirect correctly.

Keep a Redirect Log

Maintain a simple spreadsheet documenting every redirect you create: the old URL, the new URL, the redirect type, the date created, and the reason. This makes future audits much easier and prevents duplicate or conflicting redirects from building up over time.

Clean Up Outdated Redirects

Every active redirect adds a tiny amount of overhead to your site's request processing. Once a redirect has been in place for six to twelve months and the old URL is no longer referenced anywhere (in backlinks, internal links, or sitemaps), it is usually safe to remove it. Always verify with Google Search Console data before deleting.

Learning how to redirect a page in WordPress gives you full control over your site's URL structure, user experience, and search engine visibility. Whether you prefer the simplicity of a plugin, the speed of .htaccess, or the precision of PHP code, WordPress has a method to suit every skill level and scenario. If you want an even faster way to manage redirects and other WordPress tasks without digging through dashboards or writing code, WP AI Agent lets you handle everything — including creating and managing redirects — through a simple natural-language chat interface, making WordPress management accessible to everyone.

Frequently Asked Questions

What is the best plugin to redirect a page in WordPress?

The Redirection plugin by John Godley is widely considered the best free option, offering a simple interface, redirect logging, and automatic detection of slug changes. Rank Math and Yoast SEO Premium also include redirect managers if you already use one of those SEO plugins.

Will adding a 301 redirect hurt my SEO?

A properly implemented 301 redirect actually protects your SEO by passing the majority of link equity from the old URL to the new one. The small amount of equity lost (historically around 15%, though Google says it is now minimal) is far less damaging than leaving a broken 404 page that accumulates no value at all.

How do I redirect my entire WordPress site to a new domain?

The most reliable method is to add a RewriteRule in your old site's .htaccess file that redirects all traffic to the new domain, combined with updating your WordPress Address and Site Address in Settings > General if you are moving the WordPress installation itself. You should also update your sitemap and submit a Change of Address request in Google Search Console.

Can I redirect a WordPress page without a plugin?

Yes. You can add redirect rules directly to your .htaccess file (Apache servers) or your Nginx configuration file, or you can use the wp_redirect() function in PHP within your theme's functions.php file. These methods require a bit more technical comfort but work without any additional plugins installed.

Ready to manage WordPress with AI?

Get 100,000 tokens free every month. No credit card required.

Get Your Free License Key →

More from the blog