Year-End Sale: save up to 51% on every plugin licence. Ends 31 December 2026. See pricing →
Skip to content

301 Redirect WordPress: The Complete Redirect Guide (2027)

A 301 redirect in WordPress sends visitors and search engines from an old URL to a new one, and tells them the move is permanent. You need one whenever a page changes address, gets merged, or is deleted and has a close replacement. Done well, it keeps your visitors, your backlinks and most of your rankings. Done badly, it creates broken pages, slow redirect chains and lost traffic.

This 301 redirect WordPress guide covers the whole topic in one place: how redirects work, what 301, 302, 303, 307, 308, 410 and 451 actually mean, five ways to set a redirect up, the exact steps for the usual jobs (slug changes, HTTPS, a new domain, deleted pages), how to handle 404 errors, what redirects do to SEO, and how to test and fix them. Use the contents below to jump to the part you need.

How a redirect works

Every time a browser asks for a page, the server answers with a status code. A normal page returns 200 (OK). A redirect returns a code in the 300 range, together with a Location header that holds the new address. The browser reads that header and immediately requests the new URL. The visitor just sees the right page load.

Search engine crawlers do the same, but they also make a decision. They read the status code to learn whether the move is permanent or temporary, and then decide which URL to keep in their index. That is why the type of redirect you choose matters, not only the destination.

A WordPress redirect can come from three places: the web server (Apache or Nginx rules), WordPress itself (PHP code or a plugin), or something in front of your site, such as your host’s control panel or a CDN. They all produce the same result for visitors. They differ in speed, in how easy they are to manage, and in how easy it is to break your site by mistake.

Redirect status codes: 301, 302, 303, 307, 308, 410 and 451

These are the codes you will meet when you work with redirects, and what each one promises.

Code Name Permanent? Keeps the request method? Typical use
301 Moved Permanently Yes Browsers may change POST to GET New slug, merged page, new domain, HTTP to HTTPS
302 Found No Browsers may change POST to GET Short-term move, A/B test, maintenance page
303 See Other No Always switches to GET Send a visitor to a result page after a form post
307 Temporary Redirect No Yes Temporary move where a form post must stay a post
308 Permanent Redirect Yes Yes Permanent move where a form post must stay a post
410 Gone Yes Not a redirect A page removed on purpose with no replacement
451 Unavailable For Legal Reasons Not applicable Not a redirect Content blocked because of a legal demand

Two of these deserve a closer look.

301 vs 308. Both say “permanent”. The only difference is that 308 guarantees the browser repeats the same request method, so a form submission is not turned into a plain page request. For normal page-to-page moves on a WordPress site, 301 is the standard choice and Google treats 301 and 308 the same way.

302 vs 307. Both say “temporary”, and the same method rule applies. For ordinary pages, 302 is what most people use.

The 410 and 451 codes are not redirects, but they belong in the same toolbox. A 410 tells search engines the page is deliberately gone, which can clear it from results a little faster than a plain 404. Use 451 only when you have received a legal demand to block content.

Which redirect type should you choose?

Ask these questions in order:

  1. Is there a close replacement for the old page? If not, return a 404 or a 410. Do not redirect for the sake of it.
  2. Will the old URL ever come back? If not, the move is permanent. Use 301 (or 308 if you need the request method preserved).
  3. Is the move short-term? Use 302 (or 307 for the method-preserving version). Examples: a page that is down for a week, a seasonal landing page that redirects to a sale page, or a test.
  4. Is it a form or login flow? Use 303 or 307, depending on whether you want the follow-up request to become a GET.

The most common mistake is using a 302 for a permanent change. Search engines may keep the old URL in their index for a long time because you told them it was only temporary. If the move is permanent, say so with a 301.

Plan your redirects before you add them

A few redirects can be added from memory. For more than about ten, make a redirect map first. It is a simple table, usually a spreadsheet, and it stops you from making chains and wrong matches.

Old URL New URL Type Reason Priority
/seo-tips/ /wordpress-seo-tips/ 301 Slug changed High (many backlinks)
/old-services/ /services/ 301 Pages merged High
/summer-sale/ /offers/ 302 Campaign ended for now Medium
/team-2019/ (none) 410 Removed on purpose Low

To decide priority, look at which old URLs still get clicks and which have links pointing to them. If you connect Google Search Console to IT Nirman SEO, the Page Performance view shows clicks, impressions and position for each page, inside WordPress. Start with the pages that earn the most, because that is where a missed redirect costs the most.

Five ways to set up a redirect in WordPress

Method 1: Use a WordPress redirect plugin (best for most sites)

A redirect plugin lets you add, edit, test and remove redirects from the dashboard. You do not need server access, and a typing mistake will not take your site down. This is the right choice for page-by-page redirects, slug changes and 404 clean-up.

Here is how it works in IT Nirman SEO, which includes a redirect manager:

  1. Open the redirect manager in the IT Nirman SEO menu in your WordPress dashboard.
  2. Add the old URL as the source. Use the path only, such as /old-page/.
  3. Add the new URL as the target, for example https://example.com/new-page/.
  4. Pick the redirect code. The manager supports 301, 302, 307, 410 and 451.
  5. Pick the match type: exact, contains or regex.
  6. Save, then check it with the redirect tester before you tell anyone the page has moved.

The redirect list also shows how many times each redirect has been used, so you can see which ones still matter. If you need help finding a setting, the IT Nirman documentation has the setup steps.

Exact, contains and regex: how matching works

The match type decides which URLs a rule catches. It is the part of redirect work where most errors happen.

Match type What it catches Example source Use it for
Exact One URL only /old-page/ A single moved page. The safest option.
Contains Any URL that includes the text /old-shop/ A retired section. Test it, because it can catch more than you expect.
Regex Any URL that fits a pattern ^/blog/[0-9]{4}/[0-9]{2}/(.*)$ Changing a URL structure for many pages with one rule.

For example, if your posts used to live at /blog/2023/05/my-post/ and now live at /my-post/, one regex rule with the pattern above and the target /$1/ can replace hundreds of separate redirects. Test a pattern on several real URLs first. A loose pattern is the quickest way to send the wrong pages to the wrong place.

Method 2: Add rules to .htaccess (Apache)

If your host runs Apache, you can put redirect rules in the .htaccess file in your WordPress root folder. Server rules run before WordPress loads, so they are fast. Take a backup of the file before you edit it, because one wrong character can cause a server error on every page. Put your rules above the # BEGIN WordPress block.

One page to another:

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

Many pages with a pattern:

RedirectMatch 301 ^/blog/[0-9]{4}/[0-9]{2}/(.*)$ https://example.com/$1

HTTP to HTTPS for the whole site:

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

A whole domain to a new domain:

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

The weak point of .htaccess is management. After a few dozen rules, the file is hard to read, nobody on your team can see it from the dashboard, and the order of rules starts to matter.

Method 3: Add rules in Nginx

Nginx has no .htaccess file. Redirects go into the server configuration, and you need to reload Nginx after a change.

One page:

location = /old-page/ {
    return 301 https://example.com/new-page/;
}

HTTP to HTTPS, and www to the bare domain:

server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

A page removed on purpose:

location = /old-page/ {
    return 410;
}

Many shared hosts do not give you access to this file. If that is your case, use a plugin or ask your host to add the rule.

Method 4: Use your hosting panel or CDN

Most hosting dashboards have a Redirects screen where you pick a source, a destination and a code. CDNs and security services also let you create redirect rules at the edge, before the request reaches your server. These are useful for site-wide moves, such as sending a whole domain to a new one or forcing HTTPS. For page-by-page work inside WordPress, a plugin is easier because you can see the rule next to the content.

If you use a CDN or a cache plugin, clear the cache after you add a redirect. Otherwise visitors can keep seeing the old page.

Method 5: Redirect with PHP code

Developers can redirect from code. WordPress has two functions for it: wp_redirect() and wp_safe_redirect(). The default status is 302, so pass 301 for a permanent move, and always stop the script with exit straight after.

add_action( 'template_redirect', function () {
    if ( is_page( 'old-page' ) ) {
        wp_safe_redirect( home_url( '/new-page/' ), 301 );
        exit;
    }
} );

Use wp_safe_redirect() whenever any part of the destination could come from user input. It only allows redirects to your own site (and hosts you approve), which protects you from an “open redirect”, where an attacker uses your domain to send people to a harmful site. Never build a redirect target from a raw URL parameter.

What about meta refresh and JavaScript redirects?

A meta refresh redirect is an HTML tag that reloads the page with a new address after a set number of seconds. A JavaScript redirect does the same with a line of script. Both run in the browser, after the page has loaded, which makes them slower and less reliable than a server redirect. Google’s guidance says an instant meta refresh is treated as a permanent redirect and a delayed one as a temporary redirect, but not every crawler or tool agrees. Use them only when you cannot change the server or WordPress settings, and use a proper 301 whenever you can.

Redirect recipes for common jobs

You changed a post or page slug

This is the everyday case. You tidy a URL and the old one now returns a 404. IT Nirman SEO can create a 301 automatically when you change a slug, so the old address keeps working. WordPress itself will sometimes guess where an old URL should go, but it cannot be trusted for this, especially when a parent page or category also changes. After the redirect exists, update your menus, widgets and in-post links to the new URL, so people and crawlers do not need to pass through the redirect at all.

Moving from /2023/05/post-name/ to /post-name/ changes every post URL at once. Do it only with a good reason. Add a regex redirect that maps the old structure to the new one, test a sample of posts, then check your 404 report daily for the first two weeks.

You are moving from HTTP to HTTPS, or choosing between www and non-www

Only one version of your site should answer. Pick one address, for example https://example.com, and 301 every other variant to it: http://example.com, http://www.example.com and https://www.example.com. This is a server-level job, so use the .htaccess or Nginx examples above, or your host’s redirect screen. Then update the WordPress Address and Site Address in Settings so they match.

You are moving to a new domain

A domain move is the biggest redirect job, so work through it as a checklist:

  1. Crawl the old site and export every URL that matters.
  2. Build a redirect map that sends each old URL to the equivalent page on the new domain, not just to the homepage.
  3. Set up the redirects on the server so they run for every URL on the old domain.
  4. Update internal links, canonical tags and your XML sitemap on the new site.
  5. Add and verify the new domain in Google Search Console, and use the change of address tool for the old one.
  6. Ask the most important sites linking to you to update their links.
  7. Keep the redirects in place for at least a year, and keep the old domain registered.
  8. Watch Search Console for crawl errors and drops for several weeks.

Agencies that move several client sites a year will find the process easier with one standard plugin on every site. A Business licence of IT Nirman SEO covers up to five live sites, and the agency solutions page explains how the plugins fit that kind of work.

You merged or deleted a page

If two posts cover the same topic, merge the best parts into the stronger one and 301 the weaker URL to it. If a page is outdated and nothing replaces it, let it return a 404 or a 410. For an online store, a discontinued product with no direct replacement can redirect to its category page, which is the closest useful destination.

You need to keep query strings or tracking parameters

A redirect usually drops query strings unless you pass them on. If your campaigns use UTM parameters, make sure the redirect keeps them, or the campaign data will be lost. Test one tagged URL after you set the redirect up.

You need to send users somewhere after login

WordPress uses a redirect_to parameter to send people to a page after they log in. That is a different job from a 301. It is a user flow, not a permanent move, and it should use wp_safe_redirect() in code so the destination cannot be abused.

How to handle 404 errors

A 404 means a URL was requested and nothing was found. Not every 404 is a problem. Bots probe for files that do not exist all day, and your 404 log will always show some of that noise. What matters is the 404s that real people and real links reach.

The 404 monitor in IT Nirman SEO lists the missing URLs and how often each was requested, and you can search and sort the list. Sort what you find into three groups:

What you find What to do
A moved page or a close replacement exists Add a 301 to the best matching page.
The page is gone and nothing replaces it Leave the 404, or return a 410 to say it was removed on purpose.
Junk URLs, bot probes, strange file requests Ignore them.

Should you redirect all 404 errors to the homepage?

No. A 404 redirect to the homepage looks tidy, but it confuses visitors who expected a specific page, and search engines often treat it as a “soft 404”, which means the redirect passes no value. Redirect a URL only when the new page really answers what the visitor was looking for. A helpful 404 page with search and links to your main pages serves people better than a blanket redirect.

404 or 410?

A 404 says “not found” and leaves open the chance that the page returns. A 410 says “gone, on purpose”. For a page you removed deliberately and will not bring back, a 410 is the clearer message. In practice, both end up dropped from search results; 410 can just be quicker.

What redirects do to SEO

Do 301 redirects hurt SEO?

No. A correct 301 does not hurt SEO. Google has said that redirects do not cause a penalty and that a 301 passes ranking signals to the new URL. Trouble starts when redirects are set up carelessly. Watch for these:

  • Redirect chains. A goes to B, B goes to C. Each hop slows the page and wastes crawling. Googlebot follows a limited number of hops, so point the old URL straight to the final address.
  • Redirect loops. A goes to B and B goes back to A. The browser stops with an error and nobody sees the page.
  • Irrelevant targets. Sending a page about running shoes to a page about web hosting. When the pages are unrelated, search engines may ignore the redirect and treat it as a soft 404.
  • Removing redirects too early. Keep a 301 in place for at least a year, and longer while the old URL still has links pointing to it.
  • Redirecting to a page that is blocked or set to noindex. The redirect then sends value to a page that cannot rank.

Keep the rest of your SEO signals in line with the redirect

A redirect does not work alone. After you add one, make sure the new URL is the one listed in your XML sitemap, that the page’s canonical tag points to itself, and that your internal links use the new address. IT Nirman SEO’s Link Health check can find internal links that return a 404 or pass through a redirect chain, which is a quick way to find links you forgot to update. You can read more about how the plugin handles sitemaps, canonical tags and technical SEO on the IT Nirman SEO page.

Do redirects slow down my site?

Every redirect adds one extra request, so a visitor who goes through one waits a little longer. One hop is usually not noticeable. Several hops add up, which is another reason to avoid chains. There is also a difference in cost between methods. A server rule runs before WordPress loads. A plugin redirect runs inside WordPress, so each one starts a normal page load before it redirects. For a normal site with tens or hundreds of redirects, a plugin is fine. For a migration with many thousands of URLs, server rules are the better tool, and it is common to use both: server rules for the bulk and a plugin for day-to-day changes.

How to test a redirect

Test every redirect after you add it. Check three things: where the old URL ends up, which status code it returns (301, not 302), and how many hops it takes.

  1. Use the redirect tester in IT Nirman SEO to see where a URL ends up, before you rely on the rule.
  2. Use a command line check. The command curl -I https://example.com/old-page/ prints the status code and the Location header. Add -L to follow every hop.
  3. Use your browser’s developer tools. Open the Network tab, tick “Preserve log”, and load the old URL. You will see each request and its status code.
  4. Use a private window. Browsers cache 301 redirects hard, so an old test can mislead you. A private window, or a fresh browser profile, gives a clean result. If you are experimenting, use a 302 first and switch to 301 when it works.
  5. Use Search Console. The URL Inspection tool shows how Google sees the old and new URLs after it has crawled them.

Redirect problems and how to fix them

Problem Likely cause Fix
“Too many redirects” error A loop: two rules send the page back and forth, often an HTTPS or www rule fighting with a plugin or a host setting. Turn rules off one at a time to find the pair. Keep the HTTPS or www rule in only one place.
The redirect does not work Cached page, a rule placed after another one that matches first, or the wrong match type. Clear the browser, cache plugin and CDN caches. Check the order of rules. Test with exact match.
The old URL still shows in Google Google has not recrawled it yet, or the redirect is a 302. Make sure it is a 301, submit the new URL in Search Console and wait. It can take weeks.
The redirect goes to the wrong page A “contains” or regex rule that is too broad. Narrow the pattern, or switch to exact match.
Redirect chain An old redirect points to a URL that was redirected later. Edit the first redirect so it points to the final URL.
A form stops working after a redirect A 301 or 302 changed a POST into a GET. Use 307 or 308 so the method is kept.

How to choose a WordPress redirect plugin

The best WordPress redirect plugin is the one that fits how you work. Look for these things:

  • Match types. Exact for safety, contains for sections, regex for patterns.
  • Redirect codes. At least 301, 302 and 307, plus 410 for removed pages.
  • Automatic redirects on slug changes, so you do not rely on memory.
  • A 404 log that is easy to search, so you can see what is really missing.
  • A tester, so you can check a rule before you publish it.
  • Hit counts, so you know which redirects are still used.
  • Where the data lives. Redirect and 404 data should stay on your site.
  • What else it does. A standalone redirect plugin is fine. A full SEO plugin that includes redirects saves you another plugin to update.

IT Nirman SEO offers exact, contains and regex matching, the codes 301, 302, 307, 410 and 451, automatic 301s on slug changes, a redirect tester and a 404 monitor. For fairness, here is what it does not do: it has no conditional redirects based on things like login status or browser, and it does not offer a 308 code, so use a server rule for that. If you are weighing it against Yoast, Rank Math, AIOSEO or SEOPress, our SEO plugin comparison puts the features side by side.

301 redirect checklist

  • List every old URL and match each one to the closest new page.
  • Use 301 for permanent moves, 302 or 307 for temporary ones, 410 for removed pages.
  • Redirect straight to the final URL, with no chains.
  • Do not send unrelated pages to the homepage.
  • Update internal links, menus, canonical tags and the XML sitemap.
  • Keep query strings and tracking parameters when they matter.
  • Test the status code, the destination and the number of hops.
  • Clear your cache plugin and CDN.
  • Review your 404 log every few weeks.
  • Keep redirects for at least a year.

Frequently asked questions

What is a 301 redirect?

A 301 redirect is a permanent redirect. It sends visitors and search engines from an old URL to a new one and tells search engines to replace the old address with the new one in their index.

How do I redirect a page in WordPress without a plugin?

Add a rule to .htaccess on Apache, a return 301 rule in your Nginx configuration, a redirect in your hosting panel, or a short PHP function using wp_safe_redirect(). A plugin is simpler to manage and safer to edit.

What is the difference between a 301 and a 302 redirect?

A 301 is permanent. A 302 is temporary. Search engines move their index to the new URL after a 301 and keep the old URL after a 302.

Is a 308 redirect better than a 301?

They both mean permanent. A 308 also guarantees that the request method stays the same, which matters for form posts. For normal page moves, 301 is fine and Google treats both alike.

How long does a 301 redirect take to work?

The redirect works as soon as you save it. Search engines need to recrawl the old URL before search results show the new one, which can take days or weeks.

A 301 passes ranking signals to the new URL, and Google has said redirects do not lose value because of the redirect itself. The new page still needs to be a good match for the old one. If the content changes a lot, rankings can change too.

How many redirects can a WordPress site have?

There is no fixed limit. Keep each URL to one hop. For very large lists, use server rules so WordPress does not have to load for each one.

How long should I keep a 301 redirect?

At least a year. Keep it longer if the old URL still has backlinks or traffic. For a domain move, also keep the old domain registered.

Should I redirect deleted pages to the homepage?

Usually not. Redirect to a close replacement. If none exists, return a 404 or a 410.

Do I need a redirect when I change a post title?

Only if the slug changes. A new title alone does not change the URL. If the slug changes, add a 301 from the old URL, or let your plugin create it.

What causes the “too many redirects” error in WordPress?

A redirect loop, usually two rules that send the page back and forth. A common case is an HTTPS or www rule on the server fighting with a plugin or the WordPress site address setting.

Can I redirect a whole folder in WordPress?

Yes. Use a regex rule in a redirect plugin, or a RedirectMatch rule in .htaccess, to map every URL in the old folder to its new path with one rule.

Where to go from here

Redirects are easier when they live in the same place as the rest of your technical SEO. IT Nirman SEO puts the redirect manager, redirect tester and 404 monitor next to sitemaps, schema and a site audit. If you want to see everything we build for WordPress, start from the products page.

Share this article
𝕏 f in ☎

IT Nirman

যত জ্ঞান-ধন করেছি অর্জন জীবনের প্রয়োজনে, তার সবটুকুই বিলাতে চাই সৃষ্টির কল্যাণে।