WordPress Redirects: How to Set Up 301 Redirects the Right Way

Picture of Ivan Predojev
Ivan Predojev

Writer

Table of Contents

You change a page slug, merge two old blog posts or move the whole site to a new domain, and a week later Search Console starts listing 404 errors. Visitors land on dead pages, links from other sites point nowhere and rankings you spent years building begin to slip. Almost every case like this comes down to missing or broken redirects.

Getting wordpress redirects right is not hard, but it does need a bit of method. You have to pick the correct status code, choose where the rule lives, avoid chains and loops and then test what really happens. This guide covers when to use a 301, 302 or 410, how the main plugins compare, how to write rules for Apache and Nginx, how to handle permalink changes and domain moves, how to find broken URLs in Search Console and how to check that every redirect works before you call the job done.

What a Redirect Actually Does

A redirect is a short answer from the server. Instead of sending the page, it sends a status code and a Location header that says “this content lives over there now.” The browser follows the new address on its own, usually so fast that the visitor never notices. Search engines follow it too, and they use the status code to decide whether to move the old URL’s signals to the new one.

That status code is the most important part of the whole setup. HTTP splits them into permanent and temporary groups. A permanent redirect tells clients that the old address is gone for good and the new one should replace it. A temporary redirect says the move is short-term, so the old URL should stay in search results.

Redirects can be set in three places, and each one has a cost. A rule in the web server configuration answers before WordPress even loads. A plugin rule loads WordPress and PHP first, then sends the redirect. A JavaScript or meta refresh redirect sends the full page and only then moves the visitor, which is the slowest and least reliable option for search engines.

301 vs 302 vs 410: Picking the Right Status Code

Most of the time you want a 301 Moved Permanently. The MDN reference for the 301 status describes it as a permanent move, and browsers cache it aggressively. Google’s own documentation on redirects and Google Search says permanent server-side redirects are the strongest signal that the target should become the canonical URL.

A 302 Found or 307 is for real temporary moves: a product that is out of stock for a week, a seasonal landing page, a maintenance page during a short fix. If you use a 302 for a permanent change, Google may keep the old URL indexed for longer, which is the opposite of what you want. When content is gone and has no good replacement, a 410 Gone tells search engines it was removed on purpose, as the MDN page for the 410 status explains.

Status CodeMeaningUse It WhenSEO Effect
301Moved permanentlySlug changes, merged posts, domain or HTTPS movesSignals move to the new URL
308Permanent, keeps the request methodSame as 301 for forms or APIs that POSTTreated like a 301 by Google
302Found, temporaryShort-term promos, A/B tests, brief maintenanceOld URL usually stays indexed
307Temporary, keeps the request methodTemporary moves that must keep POSTTreated like a 302
410Gone, no redirectDeleted content with no relevant replacementURL drops out of the index faster
404Not foundMistyped or never-existing URLsNormal, no penalty by itself

One rule keeps most sites out of trouble: redirect only to a page that answers the same need. Sending every deleted post to the homepage looks tidy, but Google often treats those as soft 404s, and visitors who wanted a specific answer just leave.

Setting Up Redirects With a Plugin

For most site owners, a plugin is the easiest way to manage redirects. The Redirection plugin is the long-standing free option. It lets you add source and target URLs, choose the status code, group rules, import and export them as CSV and log 404 errors so you can see which broken URLs visitors are actually hitting. It also supports regular expressions, so one rule can cover a whole folder of old URLs.

If you already run an SEO plugin, you may not need a separate one. Rank Math includes a Redirections module in its free version, with 301, 302, 307, 410 and 451 options plus a 404 monitor. Yoast offers a redirect manager in Yoast SEO Premium, which can also prompt you to create a redirect when you change a slug or delete a post. Running two redirect tools at once is a common cause of confusion, so pick one and disable redirect features in the other.

MethodCostSpeedBest ForWatch Out For
Redirection pluginFreeLoads PHP firstMost sites, 404 logging, regex rulesLarge logs filling the database
Rank Math RedirectionsFree moduleLoads PHP firstSites already on Rank MathOverlap with other redirect plugins
Yoast redirect managerPremium onlyLoads PHP first or server fileYoast Premium usersNot in the free version
.htaccess rulesFreeFastest on ApacheDomain, HTTPS and bulk folder movesOne typo can cause a 500 error
Nginx configFreeFastest overallSites on Nginx, high trafficNeeds server access and a reload

A plugin rule costs a little time on every redirected request because WordPress has to start before the redirect is sent. For a few dozen redirects on a normal site, the difference is too small to notice. For thousands of rules, or for site-wide moves like HTTP to HTTPS, server rules are the better place.

Server Rules for Apache and Nginx

On Apache servers, the .htaccess file in the WordPress root folder can hold redirect rules that run before PHP starts. The WordPress guide to Apache HTTPD and .htaccess shows the default block WordPress writes between the “BEGIN WordPress” and “END WordPress” comments. Put your own rules above that block, because WordPress may rewrite everything between those markers when permalinks are saved.

A single page redirect uses the Redirect directive from Apache’s mod_alias module:

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

For patterns, such as moving a whole blog folder, mod_rewrite is more flexible. The Apache guide to redirecting and remapping with mod_rewrite covers the details, and a typical rule looks like this:

RewriteEngine On
RewriteRule ^blog/(.*)$ https://example.com/news/$1 [R=301,L]

Always download a copy of the file before you edit it. A missing bracket or a stray character in .htaccess can take the whole site down with a 500 Internal Server Error, and the fastest fix is putting the backup back.

Nginx does not read .htaccess files at all, which surprises many people who copy Apache snippets from old tutorials. On Nginx, redirects live in the server block of the site’s configuration, and the server has to reload before they take effect. If your host does not give you access to that file, a plugin or the host’s own redirect tool is the practical route.

The simplest and fastest form is a return directive inside a location block, described in the Nginx rewrite module documentation:

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

For pattern moves, a rewrite with the permanent flag does the job:

rewrite ^/blog/(.*)$ /news/$1 permanent;

Prefer return over rewrite whenever the target is fixed, because it is easier to read and Nginx stops processing right away. Test the configuration with nginx -t before reloading, so a syntax error does not take every site on the server offline.

Changing Permalinks Without Losing Traffic

Changing the permalink structure is one of the riskiest redirect jobs, because it changes every post URL at once. Moving from dated URLs such as /2024/05/post-name/ to /post-name/ is a common example. The Permalinks screen under Settings lets you pick a new structure, but it does not add redirect rules for the old addresses. WordPress does remember old slugs when you rename a single post and redirects them, but that convenience does not cover structure changes, pages or bulk edits.

The safe approach is a single pattern redirect that maps the old structure to the new one. In the Redirection plugin, a regex rule with a source like ^/\d{4}/\d{2}/(.*)$ and a target of /$1 covers every dated post in one line. On Apache or Nginx, the same pattern works in a RewriteRule or rewrite directive. Test it on a few posts, a page, a category and a URL with a query string before you trust it.

Then update your internal links. A redirect fixes the old address for visitors, but links inside your own content should point straight to the final URL. Search-and-replace tools or WP-CLI can update links in post content, and a crawl afterward shows what is left.

Domain and HTTPS Migrations

Moving to a new domain or switching from HTTP to HTTPS means redirecting every URL on the site, not just the homepage. Each old address should go to its exact counterpart on the new domain, with the path kept intact. Google’s guide to site moves with URL changes recommends server-side permanent redirects and keeping them in place for at least a year, and in practice it is wise to keep them for good.

A combined HTTPS and non-www rule on Apache looks like this, placed above the WordPress block:

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

This sends both http://www.example.com and http://example.com to the secure bare domain in one hop instead of two. After a domain move, verify the new domain in Search Console and use the Change of Address tool from the old property. If you are planning a full move, our guide on how to migrate your WordPress site walks through the steps around the redirects, from backups to DNS.

Finding Broken URLs in Search Console

You cannot fix redirects you do not know you need. The Page indexing report in Google Search Console lists URLs that return “Not found (404),” and you can export the list. Many of these are old URLs that still have links pointing at them, and those are exactly the ones worth redirecting. Others are junk URLs created by bots, and they can safely stay as 404s.

Sort the list by value before you write rules. A good order of work looks like this:

  • URLs with backlinks from other sites, checked in your SEO tool or the Links report
  • URLs that still get traffic, seen in the Redirection 404 log or Rank Math 404 monitor
  • Old URLs that appear in your own menus, widgets or content
  • Old URLs listed in an outdated XML sitemap
  • Everything else, which can usually stay as a 404 or become a 410

The URL Inspection tool is useful once rules are live. Inspect an old URL and Google shows whether it sees the redirect and which page it picked as canonical. Use it on a handful of important URLs after a big change rather than waiting weeks for the reports to update.

Redirect Chains and Loops

A redirect chain happens when one redirect points to another redirect, which points to a third. It often grows over years: a post moves in 2021, moves again in 2023 and the site switches to HTTPS in between. Every hop adds a round trip to the server and slows the visitor down, and Google notes that it follows a limited number of hops before it gives up on the URL.

The fix is to flatten the chain. Find every rule whose target is itself redirected and point it straight to the final URL. In the Redirection plugin, sort by target and look for targets that also appear as sources. A crawl tool that reports redirect chains makes this much faster on larger sites.

A redirect loop is worse, because the URL never resolves at all. The browser shows “too many redirects” and gives up. Typical causes are an HTTPS rule fighting a proxy or CDN that already handles HTTPS, a plugin rule that conflicts with a server rule, or the WordPress Address and Site Address in Settings disagreeing with the redirect target. Disable rules one layer at a time, starting with the CDN, then the server, then plugins, until the loop stops.

Testing Redirects Before You Trust Them

Clicking an old link in a browser is not a reliable test. Browsers cache 301s, sometimes for a long time, so you may see the old behavior after fixing a rule, or the new behavior after removing it. The quickest honest test is curl on the command line, which shows each hop and its status code:

curl -sIL https://example.com/old-page/ | grep -iE "^(HTTP|location)"

The output should show exactly one 301 and then a 200 on the final URL. Two or more 301 lines mean a chain. A 302 where you expected a 301 means the wrong rule fired, often from a plugin default. After any change, also purge caches in your caching plugin and CDN, because a cached redirect can hide the fix. If caching layers are new to you, our explainer on WordPress caching shows where each layer sits.

For bigger changes, test from a list. Put old and expected new URLs side by side in a spreadsheet, run each through curl or a bulk checker and compare the results.

  • Every old URL returns a single 301 to the expected target
  • The target returns 200, not another redirect or a 404
  • Query strings and UTM parameters survive where they should
  • HTTP, HTTPS, www and non-www versions all land on the same final URL
  • Mobile and desktop requests behave the same way

Common Redirect Mistakes and How to Fix Them

Most redirect problems repeat across sites. The table below collects the ones we see most often and the simple fix for each.

MistakeWhat Goes WrongFix
Using 302 for a permanent moveOld URL stays indexed longerChange the rule to 301
Redirecting all deleted pages to the homepageSoft 404s, unhappy visitorsRedirect to a relevant page or return 410
Rules placed inside the WordPress block in .htaccessLost when permalinks are savedMove rules above BEGIN WordPress
Copying Apache rules to NginxRules are ignoredRewrite them as Nginx return or rewrite directives
Two redirect plugins activeConflicts and extra hopsKeep one tool, disable the other
Internal links pointing to old URLsExtra hop on every clickUpdate links to the final URL
Removing redirects after a few monthsOld backlinks break againKeep migration redirects for at least a year, ideally for good

The last one deserves a second look. Redirects are cheap to keep and expensive to lose, because backlinks from other sites rarely get updated. Redirect speed matters too, and our guide on how to speed up a WordPress website covers the other places where load time hides.

How Webueno Handles WordPress Redirects

At Webueno, redirect work falls under our SEO service, where technical SEO covers fixing errors and broken pages and making the site easy for Google to crawl. We work from Search Console data, map old URLs to the right new ones, choose the status code for each and test every rule before closing the ticket. When something already broke, such as a redirect loop after an HTTPS change, our troubleshooting service handles server-related issues and fixes after updates.

Our WordPress hosting runs on DigitalOcean with one site per server, and staging and live sit on the same server, so we can test redirect rules on staging before they touch real visitors. Migration is included when you move a site to us, which is exactly when a careful redirect map matters most.

Work is billed in credits, where 1 credit equals 1 hour of work at $42, with no long-term contracts, and bundles save up to 21%. Every task is tracked, so you can see the time spent. Agencies get a white-label agency account and set their own margin, so redirect cleanups and migration support become part of their own service.

Keep Every Old URL Pointing Somewhere Useful

Good redirects are invisible. A visitor clicks an old link and lands on the right page, Google moves its signals to the new address and nobody sees a 404. Pick the right status code, keep rules in one place, avoid chains and loops and test with real requests rather than trusting the browser.

If you would rather hand the redirect map, the rules and the testing to someone else, create your Webueno account and open a ticket for the site that needs them.

Frequently Asked Questions

These are the questions we hear most often from site owners and agencies working on redirects.

What Is the Best Redirect Plugin for WordPress?

For most sites, the free Redirection plugin is a solid choice, with 404 logging, regex rules and CSV import. If you already use Rank Math, its free Redirections module does the same job without another plugin.

Does a 301 Redirect Hurt SEO?

No. A 301 to a relevant page is the recommended way to move content, and Google treats it as a strong signal to move ranking signals to the new URL. Problems come from chains, loops and irrelevant targets.

How Long Should I Keep 301 Redirects?

Google recommends at least a year after a site move. In practice, keep them as long as possible, because old backlinks and bookmarks keep sending visitors for years.

Should I Redirect 404 Pages to the Homepage?

Not as a blanket rule. Google often treats homepage redirects for unrelated content as soft 404s. Redirect to a page that answers the same need, or return a 404 or 410 when nothing fits.

Why Is My WordPress Redirect Not Working?

The most common causes are a cached old redirect in the browser or CDN, Apache rules on an Nginx server, rules placed inside the WordPress block in .htaccess, or two plugins fighting. Test with curl after purging caches.

What Causes Too Many Redirects in WordPress?

Usually an HTTPS or www rule that conflicts with a CDN, proxy or the WordPress Address setting. Disable redirect layers one at a time, starting with the CDN, until the loop stops.

You may also like

Ready to Move Your Website and Business Forward?

No contracts. No unnecessary complexity. Just reliable execution and real results.