• Haja

    (@hajakutbudeen)


    Hello,

    I am running a single eCommerce WordPress site with the domain name?example https://www.website.com. We have also added subdomains on our server, such as bahrain.website.com and saudi.website.com.

    Our website is accessible in both Saudi Arabia and Bahrain.

    We have installed the GeoIP addon, which allows us to detect the user’s location.

    We would like to change our site’s domain name based on the user’s location. For instance, if a user visits from Bahrain, we want to dynamically change our domain name to bahrain.website.com. Similarly, if a user visits from Saudi Arabia, we want to change our domain name to saudi.website.com.

    Is it possible to achieve this in WordPress? Or Is there anyway to do same concept with subpath like website.com/bh and website.com/sa

    Kindly advise us on the best approach to implement this functionality.

Viewing 2 replies - 1 through 2 (of 2 total)
  • By default and in most cases ever, WordPress runs on a single domain only. You can point other domains to it, but it will always try to force the main “primary” domain.

    I did find this plugin, but it hasn’t been updated in a while, so I don’t know if it would work with the latest versions.

    Apart from that, if you need two domains, you will need two sites, or set up a Network site with two separate sites.

    Moderator bcworkz

    (@bcworkz)

    It is feasible to dynamically alter the domain WP thinks it should use. See this section about editing wp-config.php. You’re interested in the dynamic part at the end of the section, as well as the dynamic part of the subsequent Blog Address section.

    I have not verified, but I suspect this is what the plugin that catacaustic linked to does without the need to edit code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress subdomain or subpath’ is closed to new replies.