What is a 301 redirect? How to do 301 redirect?

What is a 301 redirect? How to do 301 redirect?

The most important thing in website optimization is the optimization of some details, such as: 301, 404, sitemap, robots, TDK, nofollow, H1, pseudo-static, ALT tags and external links. Every detail will have a great impact on our website. Today, editor Feng Chao will introduce to you what is 301 redirect? How to do 301 redirect?

1. What is 301 redirect?

301 redirect (also called 301 redirect, 301 jump) is a status code in the header part of the HTTP data stream returned by the server when a user or spider sends an access request to the website server, indicating that the website address is permanently transferred to another address.

Other common status codes include:
1. 200 means everything is normal
2. 404 Page does not exist
3. 302 Temporary Redirection
4. 500 Content sequence error

2. 301 redirection transfer weight

When web page A redirects to web page B using 301 redirection, the search engine can be sure that web page A has permanently changed its address, or does not actually exist, and the search engine will regard web page B as the only valid target. This is the only redirection method recommended by search engines without any doubt. More importantly, the page weight accumulated by web page A will be transferred to web page B.

So, assuming that http://www.yunmajp.cn is the selected canonical URL, the following URLs:

1. http://www.yunmajp.cn/index.html

2. http://yunmajp.cn

3. http://www.yunmajp.cn/index.html

Do a 301 redirect to http://www.yunmajp.cn, the search engine will know that http://www.yunmajp.cn is the canonical URL, and will pass the URL weight listed above to the canonical URL.

3. How to do 301 redirect

1. If the website uses LAMP (linux+Apache+MySQL+PHP) host, you can use .htaccess file to do 301 redirection. .htaccess is a regular text file that is created and edited using text editing software such as Notepad. It is stored in the root directory of the URL. The instructions in the .htaccess file are used for directory-specific operations, such as password protection, redirection, errors, etc.

For example, to redirect the page /old.html 301 to http://www.yunmajp.cn/new.html, you can put this command in the .htaccess file:

redirect 301/old.html http://www.yunmajp.cn/new.html or redirect permanent /old.html http://www.yunmajp.cn/new.html

Redirect all URLs without www (http://yunmajp.cn) to the version with www (http://www.yunmajp.cn), including:

http://yunmajp.cn/about.html redirects to http://www.yunmajp.cn/about.html and http://yunmajp.cn/dir/index.html redirects to http://www.yunmajp.cn/dir/index.html, etc., and mod_rewrite module .htaccess file instructions are also needed


2. If the website uses a Windows host, you can make a 301 redirect setting on the control panel.

Purely static HTML pages cannot do 301 redirects. You can do JavaScript or Meta Refresh redirection in HTML, but you cannot do 301 redirection. Once the html is read, a 200 OK status code can be returned.

<<:  What is nofollow? What does nofollow mean?

>>:  Seven tools that website SEO optimizers must know. How many do you know?

Recommend

The birth and development of micro games from Apple Watch

By Robert Jackson Smartwatches are everywhere, bu...

Alibaba CTO Wang Jian: The era of computing economy has arrived!

Rethinking cloud computing This is the first time...

7 Myths About Men's Health: Do You Believe Them?

Author: Xue Qingxin, registered dietitian Reviewe...

Li Niuniu-Live Selling Practical Course

Li Niuniu - Live Streaming Sales Course Resource I...

3 tips for high-conversion promotion creativity!

What kind of creative has a high click-through ra...

If cats have "universal fingerprints", is your phone still safe?

Since the iPhone 5s introduced fingerprint recogn...

World Earth Day | How many people can the earth support?

As early as 2012, the academic journal Journal of...

A black hole may have passed through Earth, but we just haven't seen it yet

Do you think black holes are far away from our li...

Unboxing the 1,000-yuan Redmi Note

There are two versions of Redmi Note, both of whic...

2021, the first year of traffic marketing collapse

2021 is about to end, and someone said, Yang Yang...

When the Siberian Tiger is called "Big Hakimi"...

Erbin has become really popular recently! The hos...