How to: 301 Redirect How to post using .htaccess

10
0

If you have blogged as long as I have, over 13 years as of the date of this post. You often run into old posts that are just no longer valid for you site or valid for your readers. It could be because the content is no longer valid. It could be a post on how to do something and the directions are no longer accurate because times change.  You may automatically think that you can just delete the post and be done with it.  However, this is not the correct solution.

Yes, you can delete the post so that it no longer shows up in your feed or searches. However, it will still show up in searches used by Google, Bing, and Yahoo. Once they are indexed by the search engines they are there and will come up in searches. This means that if someone does a search and clicks a link to an old post of yours and that post is deleted they will come to a 404 Error page.  This isn’t a good thing to happen because Google hates 404 error pages.

301-Redirect-htaccess

 

How to: 301 Redirect How to post using .htaccess

There is a fairly easy process to fix this error though. There are several ways of doing this, however, this is the one way I found to be the easiest and quickest.  You can still delete the post from your site. However, you need to add a small bit of code into your .htaccess file for each post you want to delete.

In order to do this process  you will need access to your .htaccess file on your server (where your blog is hosted), a small line of code to place in the .htaccess file, and then you can delete the post or you can leave the post there and it will still redirect the post if someone goes to it.

Editing your .htaccess file

Although this is a very easy thing to do, you do have to be very careful when working with this file because if you make a mistake it can break your site. You can fix the problem if this occurs but it is always better to be very careful and only change what you need to and always make a backup copy of the file before editing it.

htcacess-File-e1398004783557-700x57.png

In order to redirect a post or page from your WordPress blog, you will need to have the exact URL of the post and include it in a small line of code. This code should be placed at the beginning of your .htaccess file. Nothing should be before any redirect codes.

Redirect 301 /old-page-name http://livingtothefullest.com/new-page-name

That may look a little confusing but it is really easy.  Here is an example of how I would want to redirect this post to different pages of Shawn Ann’s World.

Redirect to the main site:

Redirect 301 /how-to-301-redirect-how-to-post-using-htaccess http://livingtothefullest.com

Redirect to Mom Tech Category page:

Redirect 301 /how-to-301-redirect-how-to-post-using-htaccess http://livingtothefullest.com/category/mom-tech/

Delete Irrelevant Post

This is an optional step, you do not need to delete the post, but if you know that you will never need to refer back to the post then you should just delete it.  The only time you may want to not delete the post is if is something you might be able to update and/or fix later or create a new post from the information within that post.  That way you don’t necessarily have to completely rewrite a post.

10 Comments

  1. Liz
    Twitter:

    April 28, 2014 at 7:40 am

    Good post. Do you know if there’s any way to do this in Blogger? We do this all the time at work but we use a content editing platform that has a way to do it.

    Reply

    • Shawn Ann Griffith

      April 28, 2014 at 7:45 am

      Since I don’t use Blogger I don’t know how to do it off hand, but I can look into it for you.

      Reply

  2. Detroit Duchess
    Twitter:

    April 28, 2014 at 11:23 am

    I will need to save this for future reference – most of the time I just try to go back and update the post so it will be more relevant.
    Detroit Duchess recently posted…5 on Friday: Bridesmaid EditionMy Profile

    Reply

    • Shawn Ann Griffith

      April 28, 2014 at 1:05 pm

      I still do this also, however there are some posts that just can be updated to be more relevant.

      Reply

  3. Lindsey Clair

    April 28, 2014 at 10:18 am

    Wow this is great info to know. Thanks so much for sharing this. I definitely need to do this with a few posts.
    Lindsey Clair recently posted…Looking for Tickets? Check out ScoreBig {Review}My Profile

    Reply

  4. Stephanie

    April 28, 2014 at 12:31 pm

    Thanks for the tips. I would be interested in one for blogger as well.
    Stephanie recently posted…Putting Edge Novi GiveawayMy Profile

    Reply

  5. Aly Mashrah

    April 29, 2014 at 12:42 am

    Firstly, congrats on your 13 years of blogging, that is amazing! Second, thank you for posting this! On my other blog I have so many old coupon deal posts that I want to redirect.
    Aly Mashrah recently posted…HTC One max Smartphone Giveaway! #SprintMomMy Profile

    Reply

  6. Tatanisha W

    April 29, 2014 at 1:59 pm

    wow- you have been blogging that long- that’s awesome! Congrats.
    And thank you for the tip. I need to work on some of my old posts.
    Tatanisha W recently posted…Beautiful Ceramic Knobs in 6 Colors only $1.99 Each!My Profile

    Reply

    • Shawn Ann Griffith

      April 29, 2014 at 2:32 pm

      Yes Ma’am, I originally purchased shawnann.com back in 2000. I didn’t have a WordPress blog back then, everything was coded in HTML manually.

      Reply

Leave a Reply

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

CommentLuv badge