[00] Subset Redirects, Guide
Should a deleted WordPress post get a 301 or a 410?
When to 301 a deleted post, when to send 410 Gone instead, why the home page is the wrong target, and how to set up either one in WordPress.
- Published
- Fix uses
- Subset Redirects (free)
- Reading time
- 5 min
What each status code says
When you delete a post, its URL still gets requests from old links, bookmarks and search results. The status code your site answers with tells browsers and crawlers what happened to it. The definitions are in RFC 9110 (opens in a new tab), the HTTP specification:
- 301 Moved Permanently means the resource “has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs”.
- 404 Not Found means the server “did not find a current representation for the target resource”. The specification adds that a 404 “does not indicate whether this lack of representation is temporary or permanent”.
- 410 Gone means access to the resource “is no longer available at the origin server and that this condition is likely to be permanent”.
So a 301 says “look over there”, a 404 says “nothing here right now” and a 410 says “this was here and it’s been removed”.
Use a 301 when another page replaces the post
If you merged the post into a longer guide, rewrote it at a new address or replaced it with a newer version, redirect the old URL to the new one with a 301. Visitors arrive at the content they came for, and Google treats a 301 as “a strong signal that the redirect target should be processed”, according to its documentation on HTTP status codes (opens in a new tab).
The test is whether someone who clicked the old link would be satisfied with where they land. A post about a 2023 event can redirect to the page about the 2024 one. A post about a discontinued product can redirect to its successor, if there is one.
Use a 410 when nothing replaces it
If the post is gone for good and there’s no equivalent page, answer with a 410. RFC 9110 says a 410 is “primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed”. It names limited-time promotions as a typical case.
Typical candidates on a WordPress site:
- an expired offer or a finished campaign page
- a post you retracted or removed for legal reasons
- thin or duplicate posts you pruned with nothing better to point to
Don’t redirect everything to the home page
Sending every deleted post to the home page looks tidy in a redirect list, but it doesn’t help anyone. A visitor who wanted a specific article lands on a page that doesn’t mention it.
Google’s site move guide (opens in a new tab) says: “Don’t redirect many old URLs to one irrelevant single URL destination, such as the home page of the new site. This can confuse users and might be treated as a soft 404 error.” The same guide makes one exception: if you consolidated several pages into one, you can redirect the old URLs to that consolidated page.
A 404 is fine too, as far as Google is concerned
Google’s status code documentation says: “All 4xx errors, except 429, are treated the same: Google crawlers inform the next processing system that the content doesn’t exist.” For pages already in its index, “the indexing pipeline removes the URL from the index if it was previously indexed”.
So if your deleted posts already return a 404, Google drops them without you doing anything. A 410 is the more accurate answer: RFC 9110 says it “is preferred over 404 if the origin server knows” the condition is likely to be permanent. Other crawlers and link checkers can use that difference, and it keeps deliberate removals apart from broken links in your own logs.
The Subset Redirects docs cover the difference between the codes in 404 or 410? and 410 isn’t a redirect.
Add a 410 with Subset Redirects
Subset Redirects is free and handles 301, 302 and 410 responses. To mark one URL as gone:
- Go to Subset → Redirects and click Add redirect.
- In From, enter the deleted post’s path, like
/2022/summer-sale. - Set Type to 410 Gone and leave To empty.
- Click Add redirect.
Visitors to that URL get a 410 status with your theme’s 404 template, so they still see your normal “not found” page. These requests don’t appear in the 404 Log, which keeps it for links that broke by accident.
From the command line, the same thing is one command:
wp subset redirector redirect add /2022/summer-sale --status=410
For a post that has a replacement, pick 301 Permanent instead and enter the new path in To. If you’re unsure whether the replacement is right, the status codes page explains why a 302 is safer to test with.
Send a 410 automatically when you trash a post
Subset Redirects can add the 410 for you. Go to Subset → Redirects → Settings and, under Automatic redirects, tick Send “410 Gone” for published posts that are trashed or deleted. It’s off by default.
With it on, trashing or permanently deleting a published post adds a 410 for its URL. A few conditions apply:
- Redirect the old URL when a published post’s slug or parent changes must also be ticked. It’s on by default.
- The post’s type must be ticked under Post types on the same screen.
- Your site must use pretty permalinks. With plain
?p=123URLs nothing is added. - If a redirect already exists for that URL, it’s left alone.
The new 410 shows URL change as its origin in the redirect list, with a note naming the post ID. If you restore the post and publish it again, the plugin disables the 410, because the page exists again.
Use the setting when most of what you delete has no replacement. When a post does have a successor, edit the automatic 410 into a 301 pointing at it.