301 Redirect: Don't Delete a page or post → Redirect - LearnWP

301 Redirect: Don’t Delete a page or post → Redirect

Post updated June 2023.

Restructuring your website doesn’t need to cause errors. In this post we’ll show you how to create what is known as a 301 redirect.

What happens when you delete a page?

Last week a client who wants to restructure some content on her site asked me “What happens when a page is deleted?”

The answer is that if you delete a page or a post or a category  you will break any links to that web address.

As there is no web page to display, the web server sends a page that simply says “404 Page not found”. 404 errors can have a negative effect on your website’s search ranking and can be frustrating for site users.

Prevent errors in the first place.

Think twice before you delete content. If the blog post is old, consider rewriting it, keeping the permalink unchanged.  If you significantly change the post content you can update the publish date, as we have done with this post.

How to safely delete content from your site

Don’t just delete content from your site → redirect the user to a new URL where the content now lives or where they can find related content.

A 301 redirect is a permanent redirect telling the browser and Google, when a site visitor tries to access this URL, send them to this URL instead.

During the restructuring process, make careful note of all pages, posts, categories and tags you are deleting. Search engines index archive pages so you need to include the URL for any deleted categories and tags in your list for redirection as well.

[clickToTweet tweet=”Don’t just delete #WordPress pages/posts → redirect to where content is now or related URL pic.twitter.com/Wud2KzKTIg” quote=”Don’t just delete #WordPress pages/posts → redirect to where content is now or to related content”]

How to create a 301 redirect in WordPress

Not only do you not need a redirection plugin to create a 301 redirect, but you shouldn’t use one. Most WordPress redirect plugins store 301 redirects in the WordPress database. Writing redirects to the WordPress database will make your site significantly slower. And page speed is important—-important for SEO and for user experience. 

It is preferable to create 301 redirects in your website’s .htaccess file. The .htaccess file loads before the WordPress database, making the redirection faster.

Here are two ways, using the unpaid and premium versions of the Yoast SEO plugin to create 301 redirects.

Use The Yoast SEO Plugin to create a 301 redirect in the .htaccess file

To access your .htaccess file use the Yoast SEO plugin.

SEO → Tools → File editor

This tool allows you to quickly change important files for your SEO, like your robots.txt and your .htaccess file.

In the .htaccess file add a redirect for each page you want to redirect.

Screenshot how to create a 301 redirect in the .htacess in WordPress

redirect 301 /old https://yoursite.com/new/

  • replace /old.htm with your old URL. Do not include https:// or www in the old. Do include the full path from the top level of your site to the page
  • replace https://yoursite.com/new/ with the full path. Match the site address URL exactly as found on your site’s Settings → General page — including http:// or https:// or www. Include a trailing slash (/) at the end of your URL
  • when updating permalinks include your focus keyword
  • put each redirect on its own line.

You may need to clear your site cache to see the 301 redirect in action.

Or You Can Purchase the Yoast SEO Premium Plugin

The Yoast SEO Premium plugin offers a Redirect Manager. This plugin feature will automatically create redirects when you move or delete a page.

Related Posts

If you liked this post, you might also be interested in one of these.
SEO Keyword Research Tools
5 tips for getting the most out of your iPhone Video Camera

23 thoughts on “301 Redirect: Don’t Delete a page or post → Redirect”

  1. Its interesting article, I would like to know should i delete the article from site A after redirecting to site B.

  2. Hi there!

    I am trying to get rid of old blog posts that are no longer relevant to my business any longer, therefore I won’t have new relatable content to forward it to. Should I redirect these old blog posts to the main /blog homepage or simply submit a new site map in Search Console?

  3. Hi,
    In my company we have 2 ways to migrate and redirect an article. The first one is by using a redirect tool that will automatically redirect the old url to the new one ( we copy past the content). The second one will first create a visible 404 and then we will redirect the 404 page to the new url. I am just wondering if the second option will have an impact in SEO and indexing ( the redirect is implemented most of the times few minutes after) or both ways are the same technically? Thank you

  4. Hi Ruth,
    I have about 120 crawl errors.
    Half of them are images that were not attached to a page and got indexed separately. Once I attached them to a specific pages (via WordPress Media), they now show as 404 error.
    Another half of these errors comes from: Years ago, when the website was quit new, I have changed the URL of some of my website pages. Since those pages were very new and did not have any links to them I have decided not to overload my installation with too many redirects that might slow down my page.
    All those crawl error pages do not have any link value behind them.
    Should I still redirect them? or should I wait few more years for Google to drop them?

    1. Hi David,
      Through search console submit a new site map. Go through the crawl errors and mark all the old ones as fixed, that clears them out. Next time Google crawls your site errors will come back. If the errors still exist, you’ll know that these are still affecting your site. The errors will be listed in order of importance. Deal with the top ones first.

  5. Hi, im moving blog posts from domain A to domain B, and i will do 301 redirect the way you suggest by using htaccess. However, once i copy the posts from old domain to new domain, should i manualy change the publish date of the posts to original date when post was published on old domain (if some posts are very old) or to leave today’s date as its published on new domain at time of doing 301 ? Also what to do if the original post author not exist anymore on the new domain, can we publish content under different author name? Would this make a problem in 2018..
    Last question what to do with the content that’s left on original domain A should we just send posts to trash/delete once they are copied to new domain and 301 redirected from old to new domain. Thank you

    1. When you import them using a WordPress import file, the original publish date will move with the post. If you are manually moving them then I would probably use the original date unless the content has been updated. I suppose you could create a user called Guest Author and migrate the posts to that user profile. Yes once the 301 redirect is in place you can delete the old post.

      1. Hi Ruth,

        Yes once the 301 redirect is in place you can delete the old post.

        Is it important to respect this order: 301 the old article then delete ( 404) or could we delete and then redirect the 404 page. ( I asked a similar question but it has not been approved yet)

        Thank you

  6. Hi,

    Quick question.
    Will it give any value, if I redirect posts with outdated daily tips to the category page with latest tips – if they dont have links pointing to them? Or is it fine to keep them as they are?

      1. Too many 404 errors will negatively impact your site’s ranking with Google. At the very least, setup Search Console and submit a new sitemap.

  7. Hello Ruth.
    I have a question in my mind – can i change the content of the post without changing its title and url ?
    will it hurt post ranking or will i get better result in case my new content is better than the old one….i want to delete my old post content completely and wanna add new content …will this step cause any issue or it would be fine with google and my post ranking?

    1. Hi Geeta, Absolutely! Rewriting old posts is a great way to update them and make them current. If you significantly change the post you can even update the published date to the new date—as long as your site structure doesn’t use dates in the permalink. By keeping the permalink the same you won’t need to worry about doing a 301 redirect.

  8. Pingback: How well-organized is your blog? [blog navigation quiz] | Janet Barclay

  9. Hi Ruth, im the owner of bb10apps.com a website that reviews applications for blackberry 10. Im in the middle of moving my entire website from bb10apps.com to blackberryapps.com I wanted to ask you what the difference between using Yoast 301 redirect in the advanced Tab is vs writing them in the .htaccess file. I have been using the advanced tab for redirecting all the articles I have. I pretty much cloned the website. so now articles are for example bb10apps.com/post-title now is blackberryapps.com/post-title. So I went to each article in bb10apps.com and under the advanced tab redirected each article to the corresponding one at blackberryapps.com I just want to know if that is the way I should do it. I did about half my posts which is about 150 and it works, but when I used FTP to download the .htaccess file there were no redirects on the file. So I dont know how yoast is making them redirect? and if I should be using the plugin vs writing them inside the .htaccess file. I hope you can help me out 🙂

    1. Hi Ron,

      Yoast has moved this feature to his premium plugin you’ll want to make the changes directly in the .htaccess file. You can edit the .htaccess from the Yoast plugin using “Edit Files” or using FTP to download the file add all redirects and then upload the file again.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top