I get this question quite a lot: 301 vs 302?

What is the difference between 301 and 302?

Introduction to response codes

So before I want to answer this let me first explain when this code is used. This is a status response when you request a URL from a website. Normally is all goes well the response will be 200, if the page is not there it will be 404.

The last one you want to make sure you do not get. Search engines do not like it if they point to a webpage and it is gone without a trace. This is where 301 or 302 comes in.

So how do 301/302 codes work?

We usually use this when we did a website upgrade and the URL structure has changed.

For example on the old website the URL for the contact form is :

OLD: https://yourdomain.com/content/contact-us

NEW: https://yourdomain.com/contact-us

If you just change the URL address of that page without leaving a trace where it went the search engine like Google will be disappointed. Just like your friends would be when you change your phone number and you do not give them your new number.

So this is where we use the 301 and 302 status.

301: We have moved to a new location.

302: We have moved temporarily to a new location.

So this would look for the search engine something like this:

https://yourdomain.com/content/contact-us – 301 We have moved to https://yourdomain.com/contact-us

https://yourdomain.com/content/contact-us – 302 We have temporarily moved to https://yourdomain.com/contact-us but we will go back to the old address soon.

So you see now that the search engine will now know what to do, and as a free bonus, your normal website visitor will be redirected to the right place as well without them ever felt left behind.

So now how could you implement 301 vs 302?

Sorry, we are now getting a bit more technical but we will do a simple introduction first. If you want any other examples please leave a comment and I would be happy to show you have to do it.

So the way we are going to introduce now is using the .htaccess file. This a hidden file in your website route the webserver like Apache uses to handle your website requests.

So for our 301 examples: 
https://yourdomain.com/content/contact-us – 301 We have moved to https://yourdomain.com/contact-us

We would edit our .htaccess file to look something like this:

RewriteEngine On
Redirect 301 /content/contact-us /contact-us

And for our 302 examples: 
https://yourdomain.com/content/contact-us – 302 We have temporarily moved to https://yourdomain.com/contact-us but we will go back to the old address soon.

We would edit our .htaccess file to look something like this:

RewriteEngine On
Redirect 302 /content/contact-us /contact-us

Hopefully, these examples will help you to get started and make sure you do not lose that expensive organic traffic that has cost you so much time to get.

If there are any questions or comments please use the comment function below and I will get back to you as soon as I can.

About Sprout

We are a digital consultancy company that specializes in end-to-end mobile app development, web development, and e-commerce services. We can also help you set up your product and technology department.

Related Posts

Leave a Reply

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

Newsletter

Subscribe to our newsletter and stay updated to our offers and deals!

We are committed to protecting your privacy

Popular Post