Exiting from unconnected Wordpress core files between multiple blog installations

For many reasons, I cannot use the Wordpress network solution. . I will need to support multiple Wordpress sites on the same server, and I would like to share it between them.

I would like to achieve:

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

So far I have tried:

  • to find a solution involving using symbolic links, but the __FILE__ constant gives me headaches ( more )
  • to find a solution that includes mount points on a loopback device, but I had a lot of problems besides solutions.

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

Another NTH function will have some routing functions, such as: Apache checks if the requested file exists in the root DOMAIN document, and if not, it looks at the Wordpress SHARED code base.

+4
source share
1 answer

Try this inside out. It is not tested, but I think you could avoid this strategy:

  • Create a wp-content-<hostname> folder for each host. You are going to use it in a minute.
  • Create wp-config-<hostname>.php for each site (I accept separate hostnames). It should contain information about connecting to the database, as well as the settings specified below.
  • A quick look at the kernel code verifies the use of constants such as WP_CONTENT_DIR . If you can successfully define this in your wp-config-<hostname>.php file, then you are probably golden .... except for plugins that assume that the content directory is always called wp-content .
  • Change the original wp-config.php to require() correct wp-config-<hostname>.php by examining $_SERVER['HTTP_HOST'] .

With some luck, you will have several sites and databases running on the same WP kernel, but not in multi-user mode.

0
source

Source: https://habr.com/ru/post/1390104/


All Articles