How can I set multiple domain names to direct to the same virtual host to use different homepages?

Source: Internet
Author: User
Description:
I bought a virtual host, bought multiple domain names, and set all domain names to be resolved to this virtual host, and asked different domain names to point to different home pages. What should I do?
I have not set any domain name to point to, but I know that a virtual directory can only have one default homepage, and finally I thought of an idea:
In page_load on the homepage, retrieve the URL entered by the user and obtain the domain name. Then, determine which homepage to direct to based on the domain name;
This is probably the idea, Code As follows: If ( ! Ispostback)
{
// This is a string like www.xxxx.com.
String URL = Httpcontext. Current. Request. url. Host. tostring (). tolower ();

If (URL. indexof ( " Aa.net " ) ! =   - 1 )
{
Response. Redirect ( " Http://www.aa.net/Index_a.html " );
}
Else   If (URL. indexof ( " Bb.net " ) ! =   - 1 )
{
Response. Redirect ( " Http://www.bb.net/Index_ B .html " );
}
// Other code

/// /Obtain the URL of the current request
// Request. rawurl;
/// /Obtain the URL Information of the client's last request. The request is linked to the current URL.
/// /This can be read only after the hyperlink is obtained. The read result from redirect is null.
// Request. urlreferrer;
/// /Host part of the URL Information of the current request
// Request. url. Host;
}
}

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.