Technical comparison of WordPress Multisite structures. Learn the architectural differences, DNS requirements, and Nginx configurations for Subdirectory and Subdomain networks on Hovixa VPS.

Architecting a WordPress Multisite Network: Subdirectories vs. Subdomains

WordPress Multisite allows you to run an entire network of websites from a single WordPress installation on your Hovixa VPS. The most critical decision during the architectural phase is choosing between a Subdirectory structure (example.com/site1) or a Subdomain structure (site1.example.com). This choice impacts your DNS configuration, SSL management, and Nginx server blocks.

1. Comparison of Network Types

The choice between these two architectures is usually dictated by the project's branding requirements and technical overhead.

[Image of WordPress Multisite architecture diagram showing the relationship between the Network Admin, Subdomains, and Subdirectories]

    • SSL Complexity
    •  
    •  
  •  
Feature Subdirectory (path) Subdomain (domain)
URL Format `example.com/site1` `site1.example.com`
DNS Requirement Standard A/AAAA records. Wildcard DNS (`*.example.com`).
Single Domain SSL. Wildcard SSL Certificate.
SEO Impact Authority stays on main domain. Search engines treat as separate sites.

2. Technical Requirements for Subdomains

If you choose subdomains, your infrastructure must support Wildcard resolution. This is the preferred method for "Software as a Service" (SaaS) style platforms where users get their own unique URL.

  • DNS: You must add a CNAME or A record for * pointing to your Hovixa VPS IP.
  • SSL: You must use a Wildcard SSL (e.g., via Let's Encrypt with DNS-01 challenge) to secure all possible subdomains automatically.
  • Nginx: Your server_name directive must include the wildcard: server_name example.com *.example.com;.

[Image of a DNS management interface showing a wildcard A record configuration]

3. Technical Requirements for Subdirectories

Subdirectories are easier to set up because they don't require DNS changes. However, they can conflict with existing page slugs. If you have a page named "blog" and create a subsite named "blog," the subsite will take precedence.

In Nginx, subdirectory multisite requires specific rewrite rules to ensure that /site1/wp-admin/ is correctly routed to the main wp-admin core files.

[Image of the Nginx location block logic for WordPress subdirectory multisite rewrites]

4. Enabling the Network in wp-config.php

To initialize the network, you must add the following constant to your configuration file. After refreshing your dashboard, WordPress will provide the remaining constants based on your choice.

/* Enable Multisite */
define( 'WP_ALLOW_MULTISITE', true );

/* For Subdomains */
define( 'SUBDOMAIN_INSTALL', true );

/* For Subdirectories */
define( 'SUBDOMAIN_INSTALL', false );
    

5. Technical Implementation Details

  • Domain Mapping: In modern WordPress (4.5+), you can map a completely different domain (completely-different.com) to a subsite in either architecture without extra plugins.
  • Shared Resources: All sites share the same plugins and themes directory. However, they are activated per-site or "Network Enabled."
  • Database Scaling: WordPress Multisite uses a single database but creates new tables for each site (e.g., wp_2_posts, wp_3_posts). On a Hovixa VPS with NVMe storage, this scaling is efficient until you reach thousands of sites, at which point database sharding may be required.
  • Global Search: By default, WordPress does not have a global search across the network. Each site’s database tables are isolated.

Sysadmin Advice: If you are building a network for different clients, use **Subdomains**. It allows for much cleaner SSL termination and prevents cookie collisions between sites that might occur in a Subdirectory setup.

Hjalp dette svar dig? 0 Kunder som kunne bruge dette svar (0 Stem)