I have to create a new project that is multi regional. I need to change the website url depending on the user IP address.

On my project, we will have three different domains:

  • Our main site: www.mysite.com
  • Our uk domain: www.mysite.co.uk
  • Our Australian domain: www.mysite.com.au

This project, has to be managed by only one site installation

Here is what I was thinking:

  1. Modify the htaccess file of the two "extend" domains (co.uk and com.au) to redirect users to my main one: www.mysite.com

    Here is my htaccess redirection on both of my "extend" domains (co.uk and com.au) Redirect 301 / http://www.mysite.com/

  2. On my single Wordpress instal where the site will be (.com), I will get users Ip addresses

    To it, I used the geoiploc library (working perfectly)

  3. If the user has an Uk or an AU Ip, I will redirect him to the according url.

Here is my issue: I tried to modify the url inside the function.php according to the IP detection like this.

update_option('siteurl','http://www.mysite.co.uk'); update_option('home','http://www.mysite.co.uk');

Redirections are working (can review links modification on the page). However, since I have done my "extend" domains redirections, I will always display the .com website.

So how can I avoid this problem?

Note: I found that I can use the multiple domains with analytics plug-in that will be very helpful. However, this plug-in requires "DNS settings".

Does my "extend" domains htaccess modification is enough?

Here is my plug-in set-up on my .com website:

  • Domain 1: www.mysite.co.uk
  • Wordpress address (URL): www.mysite.com
  • Blog address (URL): www.mysite.com

  • Domain 2: www.mysite.com.au

  • Wordpress address (URL): www.mysite.com.au
  • Blog address (URL): www.mysite.com.au

Note: Latter I will add a drop down list to allow users domains swapping (.com, .co.uk, .con.au)

Any help will be appreciated, cheers!



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.