301 Redirect And How To Apply It

301 Redirect and how to implement it? The question which is asked frequently by every newbie in the field of blogging. There is always a confusion related to the redirection by 301 redirect and 302 redirect.

Today I am going to explain what does 301 redirect mean? What is the difference between both?
For every blogger when the point comes about changes the domain name, adding a new page to the website, changing permalink structure, making search engine direction that the website with no ‘www’ and with ‘www’ both are same.

For What, 301 Redirect Is used?

As I have mentioned above about the use of 301 redirect. When a new page is added to the website then it is required to redirect that page t0 the website using this redirection.

When a blogger changes the permalink structures of the post then it is necessary to make the search engine aware of the change which is done by 301 redirect.

We all know that whenever we open a website then mostly we type the domain name without ‘www’. Suppose you want to open ‘www.yoursite.com’ then you mostly type ‘yoursite.com’.

But search engine considers both the URL as two different websites. To get rid of this problem 301 redirect was invented.

Difference Between 301 Redirect And 302 Redirect :

Both the redirects are somehow similar to each other we can say one is the part of another. 301 Redirect is used when a page, a domain needs to redirect permanently.

But for temporary redirects, we need to use 302 redirect. Somehow we can say that 302 redirect is the part of 301 redirect. Both are used for a redirect but one is for permanent redirect and another is a temporary redirect.

How To Implement 301 Redirect for different forms?

There are many different places for which we use 301 redirect. For every redirect, you need to add the codes at the top of your .htaccess file in your root directory.

Go to file section and open file manager. Note ( .htaccess is a hidden file so it is necessary to check on show hidden files when you open file manager). You will find the file named .htaccess there in which you have to add 301 redirect code.

  • When You Move A New Page To PHP

<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.yoursite.com” );
?>

You just have to add this code when you add a new page to your WordPress website.

  • When You Change Permalink Structure

1. There are two steps to redirecting it one is by editing .htaccess file and another is by using a plugin. I would like to tell you using a .htaccess file. There are some simple steps required.

There are many ways but you can do it by visiting here and downward of this page you will come to see a colored box with a ‘Generate Redirects‘ button. You have to click at this box and a new window will appear in front of you. Fill all the columns and you will be provided a code.

2. Copy this code to your .htaccess file.

3. Now you can change your permalink structure by visiting WordPress dashboard.

4. Change the permalinks from http://www.yoursite.com/date/post name/ to http://www.yoursite.com/post name/ if you want to appear it followed with only your post name instead of both date and post name.

5. Try to open your old link and if have done correctly then your old permalink will get redirected to new one. It can be checked by using redirect checkers. You can try 301 redirect checker.

  • 301 Redirect From Non-WWW To WWW

It is also the same. You need to open your file manager in which you will find the file named .htaccess. You have to paste the code written below to the top of the .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]

  • Domain Redirect

Suppose you have your domain name ‘www.yoursite.com’ and you want to redirect it to a new domain ‘www.yourblog.com’ then you can easily do it with 301 redirect. After redirecting, when someone types your old URL the visitor will automatically get redirected to your new domain.

Final Conclusion About 301 Redirect :

It is necessary to know about this redirect stuff for every blogger. Because in the upcoming time new bloggers will have to use it for redirecting their old page to new page, their old domain to new domain and more.

There shouldn’t be a doubt when a blogger comes across doing redirection. If you have something to ask then I would like to hear in the comment section.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.

Get Free Updates Into Your Inbox

Learn Everything Just Like I Did

SUBSCRIBE

4 comments

  1. Hey Ravi,

    I know that a lot of these types of notices are confusing for many. I’ve never changed my permalinks so this isn’t something I’ve ever had to do. I’ve been told a few times how to though should that ever happen but I certainly don’t see that taking place at this late stage of my blogging career.

    I appreciate you walking us through how this is done though, thank you.

    ~Adrienne

    1. Hi Adrienne,
      For every blogger is is really important to know about 301 redirect. May be you haven’t change your permalinks but if you do then keep in mind about this redirect to be safe. As I have explained what it the use of 301 redirect and why? In the starting phase of a blogger he/she seek for these small thinks to do but sometimes a famous blog also fails to provide it by taking it a normal stuff to write about.
      Thanks for your consideration.

  2. Finally found a solution to my problem..I have been facing this problem from last 2 days and after reading this,i implemented and got rid of the problem..
    Thanks for the tutorial

    Regards,
    suryateja

    1. Hey suryateja,

      Welcome to BloggingLove.:)
      I am glad to know that the tutorial was helpful and you have solved your problem. You know many times if you don’t do redirect then you will see the broken page or any error. So its better to do 301 redirect.
      Thanks for your visit.
      Enjoy your stay.
      ~Ravi

Leave a Reply

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