6

For many reasons I can't use the wordpress network solution.. I will have to maintain multiple wordpress sites on the same server and I'd like to share the core between them.

What I'd like to achieve is:

  • for each domain, the root folder should contain only the wp-config.php file and the wp-content folder
  • The wordpress core should be shared between multiple installation.

So far I tried:

  • to find a solution involving the usage of symlinks but the __FILE__ constant is giving me headaches ( more info )
  • to find a solution involving mountpoints on a loopback device but I ended up with many more troubles than solutions.

Is there any way, maybe some apache module ? that would help me to achieve this ? I'd like to leave the wordpress core untouched if possible ( but a couple of core changes are welcome ).

Another NTH Feature would be having some routing functionality like: Apache checks if the requested file exists in the DOMAIN document root and, if not, it looks to the SHARED wordpress codebase.

Andrea Baccega
  • 27,211
  • 13
  • 45
  • 46
  • Should be moved to http://wordpress.stackexchange.com/ – markratledge Jan 09 '12 at 20:42
  • Did you find a solution? I found a similar question asked later: https://wordpress.stackexchange.com/questions/229594/can-we-use-one-wordpress-installation-for-multiple-databases-domains-and-conten In case you want to go with multisite without the privacy issues that come by default, I added an answer here: https://wordpress.stackexchange.com/questions/303657/can-you-have-multi-site-wp-and-keep-users-separate/386282#386282 – baptx Apr 08 '21 at 10:45

1 Answers1

0

Try this inside-out approach. It is untested, but I think you could possibly get away with this strategy:

  1. Create a wp-content-<hostname> folder for each host. You are going to use it in a minute.
  2. Create a wp-config-<hostname>.php for each site (I am assuming separate host names). It should contain the database connection information as well as custom defines shown next.
  3. A quick look through the core code verifies the use of constants like WP_CONTENT_DIR. If you can successfully define that in your wp-config-<hostname>.php file, then you are likely golden....except for plugins which assume that the content directory is always named wp-content.
  4. Modify the original wp-config.php to require() the correct wp-config-<hostname>.php by examining $_SERVER['HTTP_HOST'].

With some luck, you will have multiple sites and databases running off the same WP core, but not in multisite mode.