Here's the scenario I want to know if possible and how:


  • Domain (www.foo.com) at one hosting provider.
  • Two websites, one at www.bar.com and another one at www.biz.com, each at a different hosting provider.


  • When a user enters www.foo.com, depending on the IP location, it will load www.bar.com or www.biz.com. It is important that the user sees www.foo.com (masking, not redirecting).
  • So a user from UK would navigate www.foo.com website (which is really www.bar.com) and a user from France would navigate www.foo.com website (which is really www.biz.com).

So far I have managed to find a "fix" which would consist of loading a small website with an iframe at the www.foo.com hosting, and loading the corresponding website in it. I'm wondering if there's a more elegant solution than this.

closed as too broad by Rob, John Conde Jan 14 '18 at 21:09

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Google 'geolocation load balancing'. Will cost money though. Obviously if you could use two different domains (example.co.uk and example.fr) that would be much easier. – Tim Fountain Jan 13 '18 at 15:38
  • What you’re asking for is essentially a reverse proxy. Requests for foo.com go to a web server which makes a reverse proxy request to bar.com or biz.com depending on the geolocation of the visitor. That’s all configurable within a web server like Apache or nginx. – deceze Jan 13 '18 at 15:50
  • Something let me think that we have XYproblem (xyproblem.info) here. If you describe the final result perhaps you'll have better solution. – Putnik Jan 14 '18 at 15:40
  • Is SEO a concern? Should bar.com and biz.com be accessible directly? – DocRoot Jan 14 '18 at 17:57

Iframe will not work because you want to keep links e.g. from bar.com to bar.com/contact look like to foo.com/contact.

So, as @deceze said, you need to set up reverse proxy but also you need to configure something which will make search and replace inside the servers response. Perhaps there are many such tools, but just to name one: privoxy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.