Advantages and implementation examples of pan level two domain names

Source: Internet
Author: User
Keywords SEO pan domain name

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

What is a level two domain name, we are afraid to be very clear, for example, such as www.fenlei123.cn generally as a domain name, or the main domain name, then http://beijing.fenlei123.cn and http://shanghai.fenlei123.cn is the level two domain name.





Two-level domain name Advantage


in fact, for search engines, is generally a different level two domain name as a different site to look at, that is, to a large extent, can be a level two domain name as a separate site to treat. Therefore, in the search engine ranking weights, for the two-level domain name to the high weight. More importantly, most of the search engines, especially Baidu, the basic will be included unconditionally two-level domain name. In other words, your two domain name although the lack of chain, he can also be included for you, and for ordinary Web pages, included on the less enjoyable.




The Analytic method of
level two domain name


basically all DNS support pan domain name resolution, so we just have to resolve the pan domain name to an IP on it. However, there is a problem, that is, in general, a server only allow an empty host header, if your server already has another domain name occupied by this empty host head, you need to be in the host of your site to write all the possible two domain names. Therefore, we recommend using a stand-alone server to implement the pan level two domain name.




Implementation of ASP.net redirection of
level two domain name


for the Web site program, the implementation of level two domain is basically through redirection to achieve, for the use of asp.net system, we use the following way to implement (ASP and other languages are very similar):


in the Global.asax file, the Application_BeginRequest event was intercepted and rewritten as follows:


string url = Request.Url.AbsoluteUri;


String strmatchdomain = @ "[url=http://(w{3}\.)? ([^\.] *)[\.] *fenlei123\.cn]http://(w{3}\)? ([^\.] *)[\.] *fenlei123\.cn[/url] ";


string newurl = "";


string strdomain = Split2info (URL, strmatchdomain);


if (strdomain!= null && strdomain!= "")


            {


if (URL. ToLower (). EndsWith (@ "default.aspx"))


                {


if (strdomain!= "all")


                      {


Newurl = string. Format ("[Url=file://\\partersite.aspx?code={0]\\partersite.aspx?code={0[/url]}", strdomain);


this. Context.rewritepath (Newurl);


                       }


           }





to explain this code:


if we ask for such an address: http://qingdao.fenlei123.cn, after the Split2info () method is used to handle the regular expression, Gets the Qingdao in front of the fenlei123.cn, that is, we use regular expressions to get the name of a city. Then we determine if the URL is default.aspx, because all level two domains end in Default.aspx (for this site), and then redirect the URL to the HT Tp://www.fenlei123.cn/partersite.aspx?code=qingdao, which means that this is the final page to be executed.


in this way, we achieve a pan-level two domain name by means of a pan-resolution and Web-page image, which can, of course, be implemented in other ways, such as IIS-level DLL redirection.

Classification Information network Crane dancing white Sand original, reprint please indicate the source.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.