简体   繁体   English

如何将$ _SERVER ['DOCUMENT_ROOT']用于wp多站点

[英]How I can Use $_SERVER['DOCUMENT_ROOT'] for wp multisite

I have created a subdomain site using wp multisite function . 我已经使用wp multisite function创建了一个子域站点。 Now if i want to access the Sub-Domain files and folders and all the posts to my main domain site can I do it by including $_SERVER['DOCUMENT_ROOT'] ? 现在,如果我想访问子域的文件和文件夹以及到我的主域站点的所有帖子,可以通过包含$_SERVER['DOCUMENT_ROOT']来做到这一点吗?

If i can then How to do that If I can not then how to access those files to main domain? 如果可以,该怎么办?如果不能,则如何将这些文件访问主域?

Note all my subdomain site are rooted to public.html/ isnt that means my subdomain site is directected to root directory if so then how to access the subdomain files to main directory cause there is no subdirectory for my subdomain site inst that currect? 请注意,我所有的子域站点都植根于public.html / isnt,这意味着我的子域站点定向到根目录,如果是的话,那么如何将子域文件访问到主目录,原因是我的子域站点没有当前的子目录?

I am a bit confused 我有一点疑惑

First, in your wp-config.php file, add this: 首先,在您的wp-config.php文件中,添加以下内容:

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/folder/path/to/new/dir' );

And second, also in wp-config.php, add this: 其次,同样在wp-config.php中,添加以下内容:

define( 'WP_CONTENT_URL', 'http://yoursite.com/folder/path/to/new/dir');

You can read more about changing the wp-content dir on the Codex. 您可以阅读有关在法典上更改wp-content dir的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM