To move a normal wordpress site to a subpage in a multisite network, you can do the following steps. Suppose you want to convert B.com to B.domain.com in domain.com multisite network, perform the following steps
Tạo trang con B.domain.com trên mạng netword
Các trang web của tôi > Netword admin > Trang web > Thêm mới. For example, if you have added
B.domain.com, in the list of child sites, click on
chỉnh sửa B.domain.com, then in the address bar of the browser will appear the ID of the subpage as
wp-admin/network/site-info.php?id=7. b.domain.com will have an ID of 7, remember.
Di chuyển nội dung hình ảnh từ singnal site vào trang con
Copy the Theme, Plugin active on B.com to the respective directory of the multi-page network (domain.com).
Particularly, the image folder on domain.com is slightly different, as follows.
On site B.com, Copy all files, subdirectories of wp-content/uploads/ to /wp-content/uploads/site/7/
Directory number 7 is the ID of b.domain.com.
Compress the folder to copy
If the same vps, execute the following command:
cp -av /var/www/B.com/htdocs/wp-content/uploads/* /var/www/domain.com/htdocs/wp-content/uploads/sites/7/
If other than vps, remove the necessary files and folders to reduce the size then compress again
cd /var/www/B.com/htdocs/wp-content/uploads/ tar -zcvf uploads-7.tar.gz *
Part site B.com: /var/www/B.com/htdocs/wp-content/uploads/
Part multisite domain.com: /var/www/domain.com/htdocs/wp-content/uploads/sites/7/
Copy the zipped folder into multisite, unzip
cd /var/www/domain.com/htdocs/wp-content/uploads/sites/7/ wget https://b.com/wp-content/uploads/uploads-7.tar.gz tar -xvf plugins-7.tar.gz
Xuất database của singnal site
Access the database of the B.com site, export the database which does not include the wp_usermeta and wp_user tables. See picture below.
Save the file to your computer and give it a name like: move-data.sql
Sửa database trước khi Import
Open the move-data.sql file just saved above with a text editor, for example, Sublime text, Notepad ++ or Notepad…
Tìm và thay thế
Thay thế url website
https://B.com và thay thế tất cả bằng
Thay thế wp_ với ID trang con
`wp_ và thay thế tất cả bằng
(số 7 là ID trang con tương ứng như đã nói ở trên)
Lưu lại file move-data.sql vừa chỉnh sửa
Import database vào mạng Multisite
- Backup data before performing the next steps (risk prevention).
- In the database of the multisite network (domain.com), find and delete the database tables of B.domain.com, specifically in this article, find and delete
- Import the corrected move-data.sql file into the multisite network database. Successful import will reappear the database table
Now visit b.domain.com again to see what happens. You can see that the logo and Main menu may not be correct, you just need to go to the theme manager and fix it. Most importantly, the correct images and content are displayed.
Chạy domain riêng cho trang con trong mạng
Subpages in multile networks often have domains in the form of subdomains or subfolder domains. And currently wordpress supports mapping domain without plugin. s in this article, using B.com instead of b.domain.com we do the following (the ssh section applies to webinoly, with other servers there will be their own way to map domain):
- Point the B.com domain to the ip of the server b.domain.com
- Visit: My websites> Netword admin> Website
- Edit b.domain.com
- Replace b.domain.com to B.com in the URL field and save your changes. (see picture)
- Access ssh to mapdomain and create ssl, see command below
sudo site b.com -parked=domain.com sudo site b.com -ssl=on -root=domain.com
Now you can manage websites on your multisite network easily.