How to set up different subdirectories, subdomains, or even main domain for WordPress multisite?

What is a multisite network?

Multisite network is a feature of WordPress that allows users to create and run multiple WordPress sites on a single WordPress dashboard.

The benefits of doing this are:

  • Manage multiple websites on one dashboard;
  • The account systems within the multi-site network can communicate with each other to a certain extent (and can also be set independently);
  • Different administrators can be assigned to each site in a multisite network;
  • If you want to install a plugin or theme, you only need to download it once to complete the installation and activation for multiple websites;
  • A one-time update for all websites in the network;
  • Through some plug-ins, the media files of each website can call each other.

Creating a Network for the First Time: Selecting a Domain Name Structure

The interface for creating a WordPress multisite network for the first time

When setting up a multisite network for the first time, the installation wizard allows the user to choose one of two website domain name structures:

Some servers are restricted by the server operator settings, so that only the first option, the主域名/子目录, can be selected. If you have some third-party panels to manage your server, you may also be limited to this one.

After choosing the second website domain name structure, that is,子域名.主域名, you can set up a domain name such as cdo.sanguok.com for the subsite. This domain name structure can make your subsite look more like a subsite than a subdirectory (well, that’s too subjective).

As the saying goes, “Children make choices, I want them all”

Of course, if necessary, even if you choose the second mode when setting up the multi-site network for the first time, you can still manually change the domain name to the主域名/子目录mode on the site configuration page after the website is created, such as sanguok .com/cdo 2 . In other words, if you choose the second mode from the beginning, you will have more freedom in setting your website domain name later.

Set up different subdirectories

The management portal of the original separate site has been replaced by “My Site”

After the multisite network is configured, you will find the “My Sites” entry in the upper left corner of the admin panel. Float the mouse over it, select网络管理网站in turn from the drop-down menu, and then click新增on the website management interface to start creating a sub-site.

In the “Add New Website” interface, you can fill in the URL, website title, website language, administrator email address you want to specify

If you chose the主域名/子目录structure when you first created the network, the part of the new website URL that can be filled in by default is the part of the子目录. For example, your main domain name is sanguok.com , you can fill in lzh , so that the initial address of your new site is sanguok.com/lzh . After filling in the title, language, and administrator email, you can create it.

New website settings interface

It doesn’t matter if you chose the子域名.主域名structure when you first created your network. After filling in the子域名.主域名structure provided by default, create it. Suppose you get lzh.sanguok.com , then find the website in the sub-site list, click编辑, and you can freely modify the URL bar to sanguok.com/lzh .

Set up a different subdomain

Set the entrance as above. Float the mouse to the “My Website” entry in the upper left corner of the management panel, select网络管理网站in the slide-out menu, and then click新增on the website management interface to create a sub-site.

“Add New Website” interface diagram

If you selected the子域名.主域名when you first created the network, the part that can be filled in by default for the new website URL is the part of the子域名. As shown in the figure above, assuming your main domain name is sanguok.com , you can fill in lzh , so that the initial address of your new site is lzh.sanguok.com . After filling in the title, language, and administrator email, you can create it.

After the creation is complete, try to access the new website, you may receive an error from the browser – “This page is currently unavailable” “No data sent” ( ERR_EMPTY_RESPONSE ), indicating that there is no such website. If so, it’s because you forgot to set up DNS for the new subdomain. You need to configure an A record for your new subdomain in the DNS configuration interface. If your new website is lzh.sanguok.com , create a new record under the DNS configuration interface of sanguok.com as follows:

subdomain record type IP address/target host
lzh 3 A (your server address)

Maybe you’ve set it up and still can’t access it. This may be because the time to save the settings is too recent and the configuration has not yet taken effect. Just wait a little longer.

Set up a different primary domain name

The way to set up different subdirectories, and even subdomains, is described above. You may be curious, the title of this article mentions the “primary domain name”, but the above settings do not look like allowing a different primary domain name for the subsite.

Let’s say you already have a personal site, sanguok.com , and just want to create another portfolio site. And if you adopt the mode of子域名.主域名, such as example.sanguok.com 4 , it will always feel cramped. Assuming you already own a second—or even more—primary domain name, such as example.com 5. You want to assign this domain name to a portfolio site, so what to do?

To achieve this, from the very beginning when creating a multi-site network, when choosing a domain name structure, you need to choose子域名.主域名.

Then, create a new site with a unique subdomain, following the same steps described in the “Setting up a different subdomain” section. For example example.sanguok.com . In fact, the subdomain typed in this step is temporary, so even if you ask your catboy (if you have one) to type tfdredsajh 6 , it will be fine to get tfdredsajh.sanguok.com .

Finally, find the website in the sub-site list, click编辑, and you will find that the URL bar can actually be freely modified – not only the sub-domain name can be freely modified, but also the main domain name. Just change the entire string of domain names to example.com as you want.

Epilogue

Through the above introduction, you should know how to set up different subdirectories, subdomains, and even the main domain name for WordPress multisite. If you still have questions, or have comments to guide, please leave a message in the comment area. You can also browse more WordPress tips summarized by the author , and subscribe to RSS of WordPress related articles .

1 Since the author has set a jump, after clicking this link, you will be jumped to lzh.sanguok.com .
2 Since the author has set a jump, after clicking this link, you will be jumped to cdo.sanguok.com .
3 This is an example, please replace it with your actual domain name.
4 As of the time this article was updated, no site exists for this domain name.
5 This domain name is actually a sample site held by IANA.
6 A string of characters meaningless to human beings only exists in the library of Babel written by Borges.

This article is reprinted from: https://sanguok.com/blog/how-to-set-up-different-subdirectories-subdomains-or-even-main-domains-for-wordpress-multisite-network/

For personal collection only, the copyright belongs to the original author

How to set up different subdirectories, subdomains, or even main domain for WordPress multisite? appeared first on Haowen Collection .

This article is reproduced from: https://shoucang.zyzhang.com/%E5%A6%82%E4%BD%95%E4%B8%BAwordpress%E5%A4%9A%E7%AB%99%E7%82%B9% E8%AE%BE%E7%BD%AE%E4%B8%8D%E5%90%8C%E7%9A%84%E5%AD%90%E7%9B%AE%E5%BD%95%E3% 80%81%E5%AD%90%E5%9F%9F%E5%90%8D%EF%BC%8C%E7%94%9A%E8%87%B3/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.