Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of setting the permanent redirection of the preferred domain name 301

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the method of setting the preferred domain name 301 permanent redirection for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Many friends should not know enough about the top-level domain name and the second-level domain name, it is easy to confuse the top-level domain name with the second-level domain name, and it is not clear what the top-level domain name is and what is the second-level domain name. The following is a simple example of using the domain name of Juli Network: the top-level domain name of this site is juruikj.cn without www, and the second-level domain name is www.juruikj.cn with www. Think that the domain name with www as the top-level domain name should be affected by the habit of the Internet, we habitually write the URL as a second-level domain name with www. This may be why it is easy to confuse the top-level domain name with the second-level domain name.

If the top-level domain name and the second-level domain name of the site point to the same page, because the two domain names are completely independent in the eyes of the search engine, in order not to cause the problem of "mirror site" and duplicate content, it is best to specify a preferred domain name, so that you can agree with the URL displayed by the site in the search engine. The determination of the preferred domain name also plays a decisive role in the unity of inner chain and outer chain construction. Now, generally speaking, if the two domain names point to the consent page, 301 will be permanently redirected on the site, and the new "website revision" tool launched by Baidu webmaster platform can also promote the effectiveness of 301. Although Baidu's effective time for 301 still does not meet the webmaster's expectations, there is no way. 301 is much better than not doing it at all. The redirection of the domain name of the website should be done at the beginning of the launch of the website. If the site's own top-level domain name and the second-level domain name with www point to two different pages, or to two separate sites, there is no need to set 301redirection.

So how to set 301 permanent redirection correctly?

If the virtual host cannot set 301 redirection, the webmaster has two options:

First, resolve only one domain name

For example, only second-level domain names with www are resolved, but top-level domain names without www are not resolved, or instead. But now many people like to enter the domain name of the website directly in the browser, so this method will lose some traffic.

Set 301 redirection in the code

With the use of the "website revision" tool of the Baidu webmaster platform, and each page corresponds one by one, it is easy to achieve technically, and the implementation methods of different program languages may be slightly different. If you do not understand the code, here the editor shares a simple method, we can go to Baidu to search "301 redirect online generation" as long as you fill in the domain name to be directed, the code will be automatically generated for you. Here we give the website 301 permanent redirect code developed in PHP language, first create a new .htaccess file in the root directory of the site, and then copy and paste the following code into the .htaccess file to replace juruikj.cn with your top-level domain name.

RewriteEngine OnRewriteCond% {HTTP_HOST} ^ juruikj.cn [NC] RewriteRule ^ (. *) $http://www.juruikj.cn/$1 [Lmaine Renew301]

This is the end of this article on "how to set the preferred domain name 301 permanent redirection". I hope the above content can be helpful to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 298

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report