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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

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.