是的,在问题的顶部答案中有一个很好的例子说明了如何做到这一点:Is moving wp-config outside the web root really beneficial?
标题为“的部分”How to move wp-config.php to any location on your server“提供以下解决方案:
但是,如果您将[wp config.php]移到了其他地方,会怎么样?容易的创建新的wp配置。WordPress目录中的php,代码如下:
<?php
/** Absolute path to the WordPress directory. */
if ( !defined(\'ABSPATH\') )
define(\'ABSPATH\', dirname(__FILE__) . \'/\');
/** Location of your WordPress configuration. */
require_once(ABSPATH . \'../phpdocs/wp-config.php\');
(请确保将上述路径更改为重新定位的wp-config.php文件的实际路径。)
如果遇到open\\u basedir问题,只需在PHP配置中向open\\u basedir指令添加新路径:
open_basedir = "/var/www/vhosts/example.com/httpdocs/;/var/www/vhosts/example.com/phpdocs/;/tmp/"
就是这样!