SEO
WordPress Redirects and 404 Errors: A Practical Fix Guide
In WordPress, 301-redirect permanently changed URLs to their closest equivalent, return a 410 for content you removed, and leave URLs with no replacement as 404s. This guide covers finding 404s, where redirects should live, chains and loops, bulk CSV imports and fixing sudden site-wide 404s.
By Mehmet ÇalışırPublished 14 min read

Contents
This guide is for site owners, editors and agency teams who run WordPress sites. You changed a post's slug, removed an old campaign page, or woke up to find every blog post returning a 404: all of these come down to well-built redirects and a 404 log that someone actually reads. We covered building a full redirect map for a relaunch in our guide to 301 redirects during a redesign; this one focuses on day-to-day WordPress work, the tools involved and the failures we see most often.
What are redirects and 404 errors in WordPress?
A redirect means the server answers a request for one URL with a status code that sends visitors and search engine bots to another URL. A 301 redirect is the permanent version: it says the new address has replaced the old one and that ranking signals should follow. A 404 is the server saying "there's nothing at this address."
A 404 is not a mistake in itself. For a URL that never existed, or one you removed on purpose, it is the correct answer. The problem is a valuable URL returning a 404: a page that earns links, ranks in Google or sits in your own navigation. Then the visitor and the trust that page built up are both lost.
On WordPress sites, most unnecessary 404s come from a handful of causes:
- A post or page slug was changed and the old URL was never pointed anywhere.
- The permalink structure changed, for example from date-based URLs to post name only.
- A category, tag or product was deleted or merged into another.
- The site moved to a new server or domain and some old URLs were forgotten.
- Another site linked to a misspelled URL, or an old link is hard-coded in the theme.
301, 302, 307, 410 or 451: which one should you use?
Use 301 for permanent moves, 302 or 307 for temporary ones, 410 for content you removed on purpose and 451 for content blocked for legal reasons. Google reads a permanent redirect as a strong signal that the target should be the canonical URL and a temporary one as a weak signal; the details are in Google's documentation on redirects and Google Search.
| Code | Meaning | Typical WordPress use | What search engines do |
|---|---|---|---|
| 301 | Moved permanently | Slug changes, merged posts, a new domain | The target gradually replaces the old URL |
| 302 | Found elsewhere, temporarily | A short campaign, a temporary page during maintenance | The old URL may stay indexed |
| 307 | Temporary, request method preserved | Temporary cases where a form POST must stay a POST | Treated as temporary, like a 302 |
| 410 | Gone | A discontinued product with no successor, a closed service | Similar to a 404 for indexing; a clearer message |
| 451 | Unavailable for legal reasons | Content removed after a court order or legal request | No content served; the URL drops out over time |
308, not in the table, is also permanent and preserves the request method; Google treats it like a 301.
301 or 302? A simple test
Ask yourself: "Will the old URL come back in a few months?" If not, use a 301. A coffee brand pointing its November campaign page permanently at its "Filter coffee" category should use a 301; if the same page reopens in December, a 302 is right. Leaving a 302 in place for a permanent move can keep the old URL in Google's index for a long time.
404 or 410?
Both say "no content here," and according to Google's documentation they are handled similarly for indexing. A 410 states plainly that you removed the content on purpose, so it is the clearer message for URLs you are sure about, such as products you will never sell again. If you are unsure, a 404 is the safe choice.
Where should redirects live: a plugin, .htaccess or your hosting panel?
Redirects can live in three layers: the server configuration (.htaccess or Nginx), the hosting control panel, and a plugin running inside WordPress. The server layer is fastest because the request is answered before WordPress even loads; a plugin is the easiest to manage.

A redirect plugin
A WordPress redirect plugin lets you add and edit rules from the admin area and see how often each one fires. Common options include the standalone Redirection plugin and SEO plugins with a redirect module; Rank Math includes redirects in its free version, while in Yoast SEO the feature sits in the paid tier. Feature sets change between versions, so check the current list before you install.
The trade-off is that every redirect loads WordPress and PHP. That's unnoticeable with a few hundred rules; with tens of thousands, moving some to the server can be more efficient.
.htaccess (Apache, LiteSpeed) and Nginx
On Apache or LiteSpeed hosting a single redirect looks like this:
Redirect 301 /old-page/ https://www.example.com/new-page/
Put the line above the # BEGIN WordPress block in .htaccess, because WordPress rewrites the section between those markers whenever permalink settings are saved. Nginx doesn't read .htaccess; the same rule goes into the server configuration as location = /old-page/ { return 301 /new-page/; } and needs a reload. The risk with this layer is that a single typo in .htaccess can take the whole site down with a 500 error, so keep a copy before you edit.
Your hosting panel
Redirect screens in cPanel, Plesk and similar panels usually write the rules to .htaccess or the server config for you. They are ideal for domain-level jobs: HTTP to HTTPS, www to non-www, or an old domain to a new one.
A practical division of labour:
- Domain-level rules (HTTPS, www, old domain) on the server or in the panel.
- Page-level rules that editors manage in the plugin.
- Never the same rule in two places: overlapping rules create chains and loops.
How do you find and fix 404 errors in WordPress?
You collect broken URLs from three sources: Google Search Console, a 404 monitor running on your site, and your server access logs. Together they show which 404s actually matter.
Google Search Console
In Search Console's Pages (indexing) report, the "Not found (404)" and "Soft 404" reasons list URLs Google crawled but found no content at. A 404 listed there is not a penalty, but if the list includes URLs that used to get traffic or have external links, those come first.
A 404 monitor
A 404 monitor logs the broken URLs real visitors hit, how often, and where possible where they came from. Ignore the junk URLs from bots probing for vulnerabilities; deal only with addresses that look like real content. A good monitor caps its log and cleans up automatically so your database doesn't bloat.
Server logs and a site crawl
The access logs in your hosting panel show every request, bots included, with its status code; filtering for 404 lines is the rawest and most honest view of which URLs are requested most. To find broken links inside your own site, use a tool that crawls your pages; our free SEO checker is a quick place to start.
Step by step: turning a 404 into the right redirect
Fixing a 404 means measuring its value first, then choosing the best target:

- Build the list. Merge Search Console, the 404 monitor and your logs into one sheet.
- Rank by value. Visits, external links and internal links tell you how much a URL matters.
- Pick a target for each URL. If there's an equivalent page, 301 to it; if not, a parent category only when it genuinely serves the same need; otherwise a 404 or 410.
- Create the rule in one place. Use relative paths and be consistent about trailing slashes.
- Test it.
curl -I https://www.example.com/old-page/shows the status code and the Location header. Browsers cache 301s, so test in a private window. - Update internal links. Menus and in-content links should point straight at the new URL, not the old one.
Example: an online furniture store discontinues its "Oak TV stand." If there's a successor model, the old URL gets a 301 to it. If not, and the category page genuinely lists similar products, redirecting to the TV stands category is reasonable. If the product is gone and nothing similar is sold, a 410 is the honest answer.
Bulk redirects: importing hundreds of rules with a CSV
Instead of entering dozens or hundreds of redirects one by one, importing a CSV is both faster and easier to audit. A typical file has at least three columns: source URL, target URL and status code.
- Write sources as relative paths without the domain, such as
/old-product/. - Spreadsheet apps in some locales save CSVs with semicolons; check which separator the plugin expects and save as UTF-8.
- Make sure no source appears twice and no target is the source of another rule.
- After importing, test a random sample and keep the file as documentation.
Redirects and the 404 monitor in Doruva SEO
If you'd rather handle most of the steps above from one screen, the redirect module in Doruva SEO is built for it. This free plugin, developed by Doruva, has no Pro version and is coming soon to WordPress.org.

- Redirect types: 301, 302, 307, 410 and 451, with regex support and a hit counter for every rule.
- CSV import and export: add bulk rules from a file and back up your current list.
- Automatic redirects on slug changes: when a post's slug changes, the rule is created for you.
- 404 monitor: broken URLs are logged with limits and automatic cleanup, and each one becomes a redirect in one click.
If you are switching from Rank Math, the importer also brings over Rank Math redirects, and rules can be managed with the wp doruva-seo WP-CLI commands. Modules run separately, so you can switch off the redirect module if you don't need it; a disabled module loads no code. Features change between versions, so check the current list on the product page.
Why is redirecting all 404s to the homepage a mistake?
Because an irrelevant redirect doesn't give visitors what they came for, and Google may treat it as a soft 404. A soft 404 is a URL that returns a 200 or a redirect while there's really no matching content; the problem isn't solved, just hidden.
That is why "WordPress 404 redirect to homepage" plugins are tempting but misleading. You stop seeing broken URLs, Google still treats the old addresses as worthless, and the visitor who wanted a specific product lands on the homepage and leaves.

The right approach is to redirect URLs that have a real equivalent one by one, and to serve a helpful error page that keeps the 404 status code for the rest. Your theme's 404.php template should include:
- A short, calm message saying the page wasn't found.
- A site search box.
- Your most visited categories or services.
- A contact link and, for a store, a path to the cart and current offers.
How do you fix permalink and redirect failures?
Most WordPress-specific failures fall into one of three cases: a slug or the permalink structure changed, rules got chained together, or the rewrite rules broke.
What happens when a slug changes? Automatic redirects
When you change a post's slug, WordPress core stores the old one and in most cases sends visitors of the old URL to the new one with a 301. This works best for posts; it doesn't cover every case when the page hierarchy, the category base or the whole permalink structure changes, and you never see those redirects in a list.
That's why a redirect module that creates a rule automatically on slug changes helps: the rule shows up in a list, and you can test and export it. If you are changing the permalink structure as a whole, one regular expression rule replaces hundreds of lines. Moving from date-based URLs to post name only, for instance, the source could be ^/\d{4}/\d{2}/(.+)$ and the target /$1. Better still, avoid changing the structure at all; our WordPress SEO settings guide explains how to choose permalinks right from day one.
How do you fix redirect chains and loops?
You fix a chain by pointing every old URL straight at the final target, and a loop by finding the rules that point at each other. A redirect chain is when A goes to B and B goes to C; every extra hop slows the page down and adds risk of losing signals. In a loop, A goes to B, B goes back to A, and the browser shows a "too many redirects" error.
Typical causes on WordPress sites:
- Old rules piling up across two redesigns and never being updated.
- An HTTP-to-HTTPS rule defined both in .htaccess and in a plugin.
- WordPress Address and Site Address under Settings > General not matching.
- A broad regex rule that also matches its own target.
To diagnose, curl -IL lists every hop in order. When you add a new rule, also repoint any older rule whose target was the URL you are now redirecting.
Every post suddenly returns a 404: resetting permalinks
If the homepage loads but every post and page returns a 404, the problem is almost always the rewrite rules, not your content. The first fix, and usually the only one needed: open Settings > Permalinks and click "Save Changes" without changing anything. With WP-CLI, wp rewrite flush --hard does the same job.
If it persists, check these:
- Is the .htaccess file there? As a hidden file, it is easy to miss when copying a site.
- Does it contain the standard block between
# BEGIN WordPressand# END WordPress? - On Apache, is mod_rewrite enabled and does AllowOverride permit it for the directory? Your host can confirm.
- On Nginx, does the location block include
try_files $uri $uri/ /index.php?$args;?
WordPress redirect hack: when visitors end up on another site
If visitors land on sites you don't recognise and you never wrote such a rule, it's a security problem, and it's solved with cleanup and backups rather than redirect settings. A malicious redirect usually comes from an outdated plugin or theme, a compromised password, or code injected into .htaccess or the database.
Warning signs:
- The redirect only happens on mobile, or only for visitors coming from Google; when you type the URL yourself, the site looks fine.
- There are lines you don't recognise in .htaccess or in theme files.
- Admin accounts you don't know about appear in the user list.
- The Security issues report in Search Console shows a warning.
Work through it calmly: change your hosting, FTP, database and admin passwords; restore a clean backup from before the infection; then update WordPress core, plugins and themes and delete accounts you don't recognise. If you don't have regular backups stored off the server, our WordPress backup and restore guide is a good place to start.
Common mistakes
The redirect mistakes we see most on WordPress sites:

- Using a 302 for a permanent change and not noticing for months.
- Sending every 404 to the homepage.
- Adding new rules at each redesign without updating the old ones, which builds chains.
- Keeping the same rule in both a plugin and .htaccess.
- Setting up the redirect but leaving internal links pointing at the old URL.
- Deleting rules after a few months; for site moves, Google recommends keeping redirects as long as possible, generally at least a year.
- Writing broad regex rules that also catch wp-admin or wp-login URLs.
Summary and next steps
A healthy WordPress redirect setup rests on three habits: a 301 straight to the final target for permanent changes, an honest 404 or 410 where there's no replacement, and a regular look at your 404 log. To treat redirects as part of wider site maintenance, see our technical SEO checklist.
When you face a big structural change, a migration or hundreds of broken URLs, planning the work with a specialist team protects both traffic and time. Doruva's SEO service handles the whole process, from the redirect map to Search Console monitoring, and you can also browse Doruva's other free WordPress plugins. To talk about your site, get in touch with us.
Frequently Asked Questions
Can I set up redirects in WordPress without a plugin?
Yes. Add a Redirect 301 line to .htaccess on Apache or LiteSpeed, add a return 301 rule to the server configuration on Nginx, or use the redirect screen in your hosting panel. Back up the file before you edit it.
Do 404 errors hurt SEO in WordPress?
URLs that don't exist are supposed to return 404, and that alone doesn't hurt rankings. The damage comes when a valuable URL with traffic or external links returns a 404; those should be 301-redirected to an equivalent page.
How long should I keep redirects in place?
For site moves, Google recommends keeping redirects as long as possible, generally at least a year. Keeping redirects for URLs with external links permanently is the safest option.
Do I need a redirect when I change a post's slug?
WordPress stores the old slug for posts and usually redirects on its own. When the page hierarchy or permalink structure changes this may not be enough, so a visible, testable rule is the safer choice.
What causes a too many redirects error?
It signals a redirect loop, where two rules point at each other. On WordPress it usually means the same HTTPS rule exists on the server and in a plugin, or WordPress Address and Site Address don't match.




