views:

89

answers:

3

There are 2 different websites in 2 directories ..path/siteA/ and ..path/siteB/ . I need to load one of them on domain example.com depending on their country they are visiting from.

It can't be www.example.com/siteA it must be www.example.com .

Is it posible?

Edit: found the solution.

A: 

Yes it is possible. First pages you have to ask the language or show the default language.

This is done by two methods:

  1. Each language can be lines or words assigned in separately files with each variables. By using the variable calling we can the get the language parameter.

  2. Each language can be lines or words assigned in database with separately table.

Karthik
it is not about the language.
kasp3r
Here language as taken as like country. Find the ip of the country and do the above procedure for the country.
Karthik
A: 

Configure Your webserver to listen on two different ports, one pourt should serve content from /path/siteA and the second one from /path/siteB.

Next step is to configure Pound depending on the location of the user (IP geolocalisation) and You're on Your way

astropanic
I can't configure to listen to different port. No full access to server.
kasp3r
Using different ports definitely isn't necessary.
Michael Mior
A: 

It is usually done with geo-location.

You use a redirect on example.com/index.php that redirects to example.com/pathA or example.com/pathB depending on their ip

use the header() function to redirect :)


$ip = $_SERVER['REMOTE_ADDR'];

if(...) // check location of IP
{
  header("Location: /pathA");
}
else
{
  header("Location: /pathB");
}

http://php.net/manual/en/reserved.variables.server.php
http://au.php.net/manual/en/function.header.php


Edit: Based on comment, this is what you need: http://stackoverflow.com/questions/1391685/mod-rewrite-filter-specific-pages-by-ip-and-redirect-them

Thomas Winsnes
redirection is not what i need. "It can't be www.example.com/siteA it must be www.example.com . "
kasp3r