Home>Article>Topics> What is a 301/302 redirect? How to redirect the website?

What is a 301/302 redirect? How to redirect the website?

青灯夜游
青灯夜游 forward
2022-07-12 12:07:41 3865browse

What is 301/302 jump? How to redirect the website? This article will take you through 301/302 jumps, introduce the jump methods, and analyze them from the SEO perspective to see which method is practical. I hope it will be helpful to everyone!

What is a 301/302 redirect? How to redirect the website?

Concept explanation


301 jump refers to the permanent removal of the page (permanent jump), usually called 301 jump, also called 301 redirect, 301 redirect. 301 jumps are mostly used to redirect old URLs to new URLs before they are abandoned to ensure user access. Many servers support this jump method.

302 redirect is also called temporary transfer (temporary jump), English name: 302 redirect. Also known as a temporary redirect, an instruction to a website browser to display a different URL that the browser is asked to display, used when a web page undergoes a short-term URL change. A temporary redirect is a server-side redirect that is handled correctly by search engine spiders.

Application scenario


301 jump is the jump method used after the website is revised and the URL is modified. Of course, it also needs to be judged based on the actual situation. , do you need to make a jump? For example, for a new website that has just been launched, you can simply delete the old link after changing the URL. There is no need to make an extra jump. When http jumps to https, a 301 jump is also required.

302 jump is when the link is temporarily jumped, which means that the jump time is very small, one or two months, for example, it needs to be restored later.

When adapting pc and m station pages, generally 302 jump methods are used (Baidu recommends using 301, but the effect cannot be compared). Mainly when the mobile terminal accesses the PC terminal link, it will automatically jump.

Jumping methods


There are three jumping methods for 301 and 302.

1. Front-end 301/302 jump. In this case, the jump will be dynamically triggered after the browser executes it.

2. Nginx makes 301/302 jumps, and the operation and maintenance students make jump rules on the server side.

3. The node server makes 301/302 jumps, and front-end students can handle it.

SEO effect considerations


The first method is not advisable and search engines will not recognize it.

The second and third methods usually use the second Nginx to do the jump (operation and maintenance students), which is also advocated and recognized by search engines, and is also convenient for maintenance and management; but sometimes jumps The method is too complicated (such as dozens of jump rules) and the difficulty of the Nginx side increases, then the third method needs to be adopted. The front-end students perform 301/302 jumps in the node service layer.

Regarding SEO solutions, we still need to seek truth from facts and not just apply them mechanically.

Related learning recommendations:Website construction tutorial

The above is the detailed content of What is a 301/302 redirect? How to redirect the website?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:lusongsong. If there is any infringement, please contact admin@php.cn delete