WordPress knowledge sharing

Supplement and improvement of 301 domain name redirection setting method

For the sake of taking care of newcomers, Weieis blog writes more detailed and wordy content. Since the previous release Lnmp environment setting 301 redirection and DNSPOD Settings 301 Redirection Tutorial After that, netizens kept asking him questions. In order to facilitate everyone's operation, we will explain these problems together here, which is also a supplement and improvement to these two articles.

On the network for Domain name 301 redirection There are all kinds of statements, most of which are copied and pasted, and have not been tested or taken into account the understanding ability of novice Xiaobai. In view of this, after the test and use by Old Wei himself, I summarize this article to help friends with this problem.

1. Let's talk about the benefits of 301 redirection. One reason is that Chinese people like to use the www domain name, and the habit has been deeply rooted for many years. Second, if the main domain name and www domain name do not make 301 redirects, Baidu will separately include and distribute the weight to two different domains (Baidu believes that the main domain name and www domain name are two different domains). Searching your website's keywords in Baidu will find two results, the main domain name and www domain name. This is not good for the weight of your website, but also affects Baidu's natural ranking.

Based on the above reasons, it is necessary to do 301 redirection to point the main domain name to the www domain name, so that Baidu's weight here will be unified to the www domain name. Baidu search results only show the www domain name. Some friends said that my main domain name will not be resolved, and only the www domain name can be resolved? The answer is of course, but some traffic from the main domain name will be lost in the future.

2. Two 301 redirection methods. Now let's start to redirect the main domain name to the www domain name as 301. There can be multiple settings.

2.1 Set on the NS server management background, such as DNSPOD. For specific operations, refer to the link article in the first paragraph of this article. It is suitable for virtual hosts and VPS servers. This method is extremely suitable for novices. It is easy to learn and can be done in two steps. No matter where your domain name is registered, you can set the NS server address to DNSPOD. The premise is that the visitors to your website are from home. Don't do this for foreign trade websites. Then set an explicit URL on DNSPOD and forward it to the www domain name.

Selected explosives area
618 Zhongshenghui Click to view the purchase
Selected preferential activities Click to view the purchase
Tencent Cloud Preferential Products Zone Click to view the purchase
Cross border e-commerce store server Lightweight application server
Tencent Cloud Animal Palu Game Server Click to view the purchase
For more Tencent Cloud content, please see Tencent Cloud

2.2 If you do not want to put the NS server on DNSPOD. First, find out if your domain name provider's resolution provides 301 redirection. If you don't understand, send a work order to ask customer service. If any, you can try to parse and query the https status code of the main domain name to see if it is a real 301 redirect. If this function is not available, it needs to be set in the VPS server. First, you need to add A records to both the main domain name and the www domain name to resolve to the VPS IP address, and then operate according to the article "lnmp Set 301 Redirection" in the first paragraph of this article. If you are a Windows system, please click Redirect domain name 301 in windows vps Just do it. This method is more troublesome than the first method, and it is easy for novice Xiaobai to make mistakes.

The above is the explanation and operation of Weieis blog for the 301 domain name redirection. Personally, I prefer the first method. For the VPS server using the lnmp environment under the second method, enter the command after setting 301 redirection on the VPS

curl -I vpsss.net

Query the https status of the domain name. If it is the shape shown in the above figure, 301 redirection is successful.

Like( zero )
Article name: Supplement and Improvement of Domain Name 301 Redirection Setting Method
Article link: https://www.vpsss.net/1566.html
Copyright notice: The resources of this website are only for personal learning and exchange, and are not allowed to be reproduced and used for commercial purposes, otherwise, legal issues will be borne by yourself.
The copyright of the pictures belongs to their respective creators, and the picture watermark is for the purpose of preventing unscrupulous people from stealing the fruits of labor.