Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:
  • Our uk domain:
  • Our Australian domain:

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 ( and to redirect users to my main one:

    Here is my htaccess redirection on both of my "extend" domains ( and Redirect 301 /

  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',''); update_option('home','');

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:
  • Wordpress address (URL):
  • Blog address (URL):

  • Domain 2:

  • Wordpress address (URL):
  • Blog address (URL):

Note: Latter I will add a drop down list to allow users domains swapping (.com,,

Any help will be appreciated, cheers!

share|improve this question
Yes, I did. But, I need to implement a drop down to let the user to select a domain. So, modifying the config file doesn't sound good. Let me try – Romain Oct 30 '13 at 14:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.