admin管理员组文章数量:1410724
I have following situation. I have a WP Multisite installed in subdirectory:
my-domain/subfolder/wp-multisite-root
Now normally next sites added would be created like that
my-domain/subfolder/wp-multisite-root
my-domain/subfolder/wp-multisite-root/site1
my-domain/subfolder/wp-multisite-root/site2
my-domain/subfolder/wp-multisite-root/site3
Is there any way to have it created like this?
my-domain/subfolder/wp-multisite-root
my-domain/subfolder/site1
my-domain/subfolder/site2
my-domain/subfolder/site3
There is one more trick. my-domain/subfolder/ contains another non wordpress application.
I have following situation. I have a WP Multisite installed in subdirectory:
my-domain/subfolder/wp-multisite-root
Now normally next sites added would be created like that
my-domain/subfolder/wp-multisite-root
my-domain/subfolder/wp-multisite-root/site1
my-domain/subfolder/wp-multisite-root/site2
my-domain/subfolder/wp-multisite-root/site3
Is there any way to have it created like this?
my-domain/subfolder/wp-multisite-root
my-domain/subfolder/site1
my-domain/subfolder/site2
my-domain/subfolder/site3
There is one more trick. my-domain/subfolder/ contains another non wordpress application.
Share Improve this question edited Oct 20, 2013 at 18:07 HoGo asked Oct 20, 2013 at 17:48 HoGoHoGo 3471 gold badge5 silver badges15 bronze badges 1- What non wp application means? What .htaccess / slug conflicts do you have? – brasofilo Commented Oct 20, 2013 at 20:26
4 Answers
Reset to default 7After these years I hope this will still answer your question...
I think I've got the situation working you want. Allthough I don't have the Wordpress installation in '/subfolder/', but I've a installation 'in subdirectory' per language, and on the same level:
my-domain/nl/ -> this is primary installation, site id = 1
my-domain/en/ -> this is the first site created by multistie, site id = 2
my-domain/de/ -> this is the second site created by multistie, site id = 3
It requires a bit 'hacking' in the database, but it's very easy.
Step 1: Make sure your multisite 'root' installation is working as intended in it's subdirectory. In my case I got the following in 'wp-config.php':
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // allow sub-directory install (true for subdomain install)
define('DOMAIN_CURRENT_SITE', 'my-domain/subfolder');
define('PATH_CURRENT_SITE', '/wp-multisite-root/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
(well in reality I don't have '/subfolder' :) )
Step 2: Now create you're first new site through multisite in a subfolder. When entering the foldername 'site2', Wordpress tells you it will be created as: my-domain/subfolder/wp-multisite-root/site2 That's correct, we will remove the 'wp-multisite-root' folder manually t
Step 3:
Open up phpMyAdmin/directAdmin
In the table wp_blogs
edit the entry of you're newly created site.
We will have to modify the path
of it.
It can be done with the following query:
UPDATE `wp_blogs` SET `path` = '/site2/' WHERE `wp_blogs`.`path` = '/wp-multisite-root/site2/';
Change domain name and site name accordingly. Also look for the site id mentioned there. If its the first extra site created it will be ID 2 as in my intro.
Step 4:
Look into the table wp_<SITEID>_options
.
In our case with Site ID 2, it will be wp_2_options
.
There we will have to change the option_value
where the option_name
is 'siteurl' and 'home'. It can be done by running following queries:
UPDATE `wp_2_options` SET `option_value` = 'my-domain/subfolder/site2/' WHERE `option_name` = 'siteurl';
UPDATE `wp_2_options` SET `option_value` = 'my-domain/subfolder/site2/' WHERE `option_name` = 'home';
Again, change the domain and folder name accordingly. You'll note that we remove 'wp-multisite-root' from the url there, so site2 will be on the same level as `wp-multisite-root'.
Step 5: Refresh wp-admin and your site(s) will be listed as you wanted.
Piemol's answer is great and worked for me. However, I was unable to log into any of my sites except the main site. Upon inspecting my cookies, I discovered WordPress was making a cookie for only my main site and not the other subdirectories. To use OP's example, it was making a cookie for /subfolder/wp-multisite-root
, which /subfolder/site1
could not use.
I dug through WordPress core to see what I needed to fix, and I ended up adding this code to my custom plugin to fix the paths used for the cookies:
define('COOKIEPATH', '/subfolder/');
define('SITECOOKIEPATH', '/subfolder/');
In my case, my site structure is actually like Piemol's, so I fixed my cookie paths to be the root:
define('COOKIEPATH', '/');
define('SITECOOKIEPATH', '/');
The simplest solution is to make my-domain/subfolder/
the WordPress install directory and base URL, then enable multisite configured to use subdirectories.
I've been trying to do a similar thing, and from everything I've discovered so far I think the answer is no, this isn't currently possible :(
本文标签: directoryMultisite in subfolderHow to make new sites to be in same level subfolders as the main site
版权声明:本文标题:directory - Multisite in subfolder - How to make new sites to be in same level subfolders as the main site 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744785230a2624955.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论