My client has two domains, and wishes to split a product catalogue over them. They want to have a shopping cart that is shared over both, i.e. a shared session over the two domains, this is solved in principle at least, and not the point of this question.
Am using WooCommerce (no choice in this).
Since the products need to available to be ordered in one transaction, they need to be in the same database, so I don't think a normal multisite install is going to work.
I'm hoping therefore to be able to use a single WP install, and simply put $_SERVER['SERVER_NAME']
in WP_SITEURL
& WP_HOME
.
I've seen very few references to doing this, so I'm nervous about possible unforeseen consequences.
Can anyone reassure me, or perhaps tell me why I shouldn't do this?
My client has two domains, and wishes to split a product catalogue over them. They want to have a shopping cart that is shared over both, i.e. a shared session over the two domains, this is solved in principle at least, and not the point of this question.
Am using WooCommerce (no choice in this).
Since the products need to available to be ordered in one transaction, they need to be in the same database, so I don't think a normal multisite install is going to work.
I'm hoping therefore to be able to use a single WP install, and simply put $_SERVER['SERVER_NAME']
in WP_SITEURL
& WP_HOME
.
I've seen very few references to doing this, so I'm nervous about possible unforeseen consequences.
Can anyone reassure me, or perhaps tell me why I shouldn't do this?
Share Improve this question asked Nov 12, 2013 at 11:26 jezmckjezmck 658 bronze badges1 Answer
Reset to default 1Personally, I make them default to the HTTP host:
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
There are no caveats for single WP installs. It's in fact very convenient when testing changes in a dev.example subdomain, in the sense that it allows to use the same database before rolling out a change on a live site.
Don't do this in multisite installs, however — especially you plan want domain mapping. :-)