Guide
How to fix 404 errors in WordPress with 301 redirects
Every renamed slug and deleted post leaves an old address behind. Visitors and search engines that still use it get a 404 page. A 301 redirect sends them to the right place instead.
When a 404 needs fixing (and when it doesn't)
Not every 404 is a problem. Bots try random addresses all day, and a page you removed on purpose with nothing to replace it can stay gone. Fix a 404 when:
- the address used to be a real page on your site,
- other sites or your own posts still link to it, or
- people actually visit it.
Then redirect it to the closest page that exists now. Sending everything to the homepage is tempting, but visitors find it confusing and search engines tend to treat it like a 404 anyway.
Step 1: find the 404s
- Google Search Console: under Indexing > Pages, the reason Not found (404) lists addresses Google couldn't find on your site.
- Your own links: a broken link checker finds internal links that point to pages that no longer exist. See how to find broken links in WordPress.
- Server logs: your host's access log shows every request that ended in a 404, including ones Google never saw.
Step 2: choose where the redirect lives
WordPress doesn't redirect old addresses for you, except in a few cases such as a changed post slug. You have three places to add a redirect.
In the server configuration
On Apache hosting you can add a line to the .htaccess file in your site's root folder, above the WordPress block:
Redirect 301 /old-page/ https://example.com/new-page/
On Nginx the same rule goes in the server configuration:
location = /old-page/ { return 301 /new-page/; }
This is fast, but a typo can take the whole site down, and many managed hosts don't let you edit these files. Keep a copy of the original before you change anything.
With your host's redirect tool
Many hosting panels have a Redirects page where you enter the old and new address. Fine for a handful, awkward for dozens.
With a WordPress plugin
A redirect plugin stores the redirects in your database and lets you manage them from the admin, no server access needed. The free Hrefix plugin does this for broken internal links:
- Go to Tools > Hrefix and start link checking.
- For a broken link to your own site, Hrefix suggests similar published pages.
- Pick the right one and create a 301 redirect in one click, or add redirects by hand on the Redirects tab.
Hrefix only redirects addresses that would otherwise return a 404, so a redirect can never hide a page that still exists. The redirects are stored and served by your own site. Hrefix Pro also logs the 404s real visitors hit and suggests a redirect for each one.
Step 3: check the result
- Open the old address in a private browser window. You should end up on the new page.
- Make sure it's one hop: old address straight to the final page. Chains of redirects (A to B to C) are slower, and loops (A to B to A) break the page completely.
- Update your own links to point straight to the new address. The redirect is a safety net for links you don't control.
301 or 302?
Use 301 when the move is permanent, which is nearly always the case for renamed or merged pages. Use 302 only for something temporary, like a page that's down for maintenance and coming back at the same address.
Want this done inside WordPress? Hrefix is a free plugin that finds broken links on your own site, with no account and no cloud service. Hrefix Pro (from €39 per year) adds a 404 monitor, a bulk redirect fixer and a weekly email report.