php - How to show different homepage based on the user's Country? -


My two domains were Rajicir.com and Rajasekhar. What do I need to do,

When a user of India writes the URL in the address bar as www.rajasekar.com then it should open www.rajasekar.in

When the other country user should open www.rajasekar.com www.rajasekar.com as the URL in the address bar

I think it has been implemented in GOOGLE. Please help me get it

You attempt to estimate the country based on the country's remote address can do .

The following is the work solution, you will need to work again with the diagnostic logic:

  $ remoteAddr = $ _SERVER ['REMOTE_ADDR']; $ LookupUrl = sprintf ('http://api.hostip.info/country.php?ip=%s', $ Remote Eder); $ Country = trim (file_get_contents ($ lookupUrl)); If ('IN' === $ country) {$ newUrl = 'http://www.rajasekar.in/'; Headers (Sprint ('Location:% s', $ newUrl)); Printf ('& lt; a href = "% s" & gt; moved. & Lt; / a & gt;', $ newUrl); Go out(); }  

Keep in mind that search engine robots from India are capable of crawling .com content. Although


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -