Moving wp-config.php when you have a second wordpress install

WordPress checks its main docroot for a wp-config file first, and if it’s not there, checks its parent directory. The reason you would move it is to take it outside of the publicly accessible docroot. In your case in the wordpress2 folder, moving it up just one directory doesn’t have any benefit, since it is still accessible, not to mention that it would create conflicts with the wordpress1 install.

If you really wanted to move them out of the docroot, I’d suggest putting both config files up into your htdocs/folder/ directory with different names, and then as you mentioned, use an include() to access it.

In your example, include(‘/folder/config.php’); make sure your paths are relative, or specified right from the root folder, so your wp-config would either be:

include('../wordpress1-config.php');  // for the wp1 site
include('../../wordpress2-config.php');  // for the wp2 site

or

include('/home/user/htdocs/wordpress1-config.php');  // for the wp1 site
include('/home/user/htdocs/wordpress2-config.php');  // for the wp2 site