Multisite routing guide

WordPress multisite .htaccess: subdomains vs subdirectories.

A network is not a single site with more domains. Its rewrite rules have to preserve enough path information for WordPress to identify the right site before it routes the request.

01Network mode matters.

Subdomain and subdirectory installs use similar-looking, but not interchangeable, rewrite rules.

02Keep the network block intact.

Do not replace it with the shorter single-site block when one subsite has a problem.

03Match the real base.

A network in a subdirectory needs its network setup output, not a root-install example.

Why the two network types need different rules

In a subdomain network, WordPress identifies a site primarily from the hostname: for example, shop.example.com. In a subdirectory network, the site name is part of the path: for example, example.com/shop/. Apache must leave that first path segment available to WordPress in the subdirectory case.

Network typeHow a site is identifiedRule consequence
SubdomainsThe hostname, such as shop.example.com.The rewrite block handles the usual WordPress paths without a site prefix in the request path.
SubdirectoriesThe first path segment, such as /shop/.The rules capture and pass that segment so WordPress can resolve the intended subsite.
Domain mappingThe network’s domain and site records.Do not invent rewrite exceptions first; confirm domain mapping and DNS are correct.
1 Browser requests a subsite URL2 Apache preserves the site context3 WordPress resolves the network site4 The subsite handles the page

Use the Network Setup output as the source of truth

WordPress generates a configuration snippet when you create a network. That output reflects the network type and installation path that Core knows about, so it should take priority over copied snippets from a different host or topology. A network that was moved into a subdirectory or changed from subdirectories to subdomains deserves a full configuration review, not a one-line rewrite edit.

Do not paste single-site rules into multisite.

The short single-site block can make the main site appear healthy while breaking subsite routes, uploads, or admin requests. Select the correct network type in the generator instead.

Repair a multisite rewrite issue in order

  1. 01
    Identify the network type.

    Look at a known subsite URL: a unique hostname means subdomains; a first path segment means subdirectories.

  2. 02
    Confirm the network root and base path.

    Find the directory containing the network’s wp-config.php. Do not assume it is the web root after a migration.

  3. 03
    Back up the current root .htaccess.

    Preserve any host, cache, HTTPS, or security directives that appear outside the WordPress network markers.

  4. 04
    Generate the matching network block.

    Choose subdomain or subdirectory in the .htaccess generator; use the Network Setup output for unusual paths.

  5. 05
    Test more than the main site.

    Open a public page and /wp-admin/ on the main site and on at least one subsite before declaring the repair complete.

Quick answers

Can I use the default single-site .htaccess rules for multisite?

No. Multisite needs its own rewrite block. Subdirectory networks in particular need rules that preserve the subsite path segment.

Do subdomain and subdirectory WordPress networks use the same rules?

No. They share a goal, but subdomain routing is based on the host name while subdirectory routing depends on the first part of the request path.

Where should a multisite .htaccess file live?

Put the network rewrite block in the WordPress network root, normally beside wp-config.php. A subsite does not usually have its own full WordPress root or its own network rewrite block.

Primary reference: WordPress multisite administration documentation.