Search code examples
hostingweb-hosting

Can we do multiple websites pointing one URL?


two different websites and i want one URL, example: when user visit example.com from India he get website-1 but on same domain and same URL and he visit example.com from US than he get website-2 with same URL on same domain, so any one can help me ?


Solution

  • There are multiple ways to archieve this (including but not limited to):

    • DNS based approach
    • IP based approach

    DNS based approach

    You have two servers, one for website-1 and one for website-2. Now you configure your DNS server to serve the IP for website-1 if the client is from India and website-2 if the user is from the rest of the world. This feature is referenced as GeoDNS or "Geolocation Load Balancing".

    I said "rest of the world" because you can never be sure, that there will be only requests coming only from India and the US.

    IP based approach

    Your server needs to decide after doing a GeoIP lookup of the client, which website to serve. Basically the same logic as above, but this time implemented on only one server. This can be done using most server side scripting languages and maybe even within your webserver itself.