Why Your WordPress Multisite Shows an Empty Directory After Changing a URL (And How to Fix It)
Content
Changing a site's URL within a WordPress Multisite network is a common task, but it can sometimes lead to a confusing result: the site loads a blank directory listing instead of the actual website. This guide will explain why this happens and walk you through the most reliable steps to fix it.
Why Does This Happen?
Based on common issues discussed in the community, this problem almost always occurs due to a server configuration mismatch. When you change a subsite's URL in the Network Admin, WordPress updates its internal database records. However, if the new domain (e.g., site1.com) is not properly configured on your web server to point to the main WordPress installation, the server doesn't know how to handle the request. Instead of passing it to WordPress for processing, it simply displays the contents of the folder—which is often empty, leading to a blank directory listing.
How to Fix the Empty Directory Issue
Follow these steps to resolve the problem. It's highly recommended to create a full backup of your site and database before proceeding.
Step 1: Verify Your Domain's DNS and Server Configuration
This is the most critical step. The new domain (e.g., site1.com) must have its DNS 'A' record pointing to your web server's IP address. Furthermore, your web server (e.g., Apache or Nginx) must be configured to recognize that domain and direct it to the root directory of your primary WordPress installation. This often involves setting up a parked domain, addon domain, or server alias that points to the same document root as your main network domain. If this is not done correctly, no amount of WordPress configuration will work.
Step 2: Revert the URL Change in WordPress
Since you cannot access the admin area for the broken site, you will need to manually revert its URL in the database.
- Access your database via a tool like phpMyAdmin.
- Locate the
wp_blogstable (the prefix may be different). - Find the row for your subsite and change the
domaincolumn back to its original, working value (e.g., fromsite1.comback todomain.com). - Also, check the
wp_siteandwp_sitemetatables to ensure the primary network domain is correct.
This should restore access to the subsite's admin area using its original URL.
Step 3: Perform a Complete Search and Replace
Once your server is correctly configured to handle the new domain, you can change the URL again. However, a simple change in the Network Admin may not update all references in the database. You must perform a thorough search-and-replace operation.
Recommended Method: Use a Reliable Plugin
The 'Better Search and Replace' plugin is frequently recommended in the community for this specific task. After reactivating the subsite's new URL in Network Admin, run the plugin from the subsite's own dashboard (Tools -> Better Search Replace). Search for the old URL (e.g., https://domain.com/site1) and replace it with the new one (e.g., https://site1.com). Ensure you select all database tables specific to that subsite.
Important Note on WP-CLI:
While powerful, using wp search-replace via WP-CLI for a single subsite in a network can be tricky. As noted in community discussions, the command must be run with the --url parameter targeting the specific subsite to ensure it only affects the correct tables. An imprecise command can miss data or accidentally break other sites in the network.
Step 4: Clear All Caches
After making these changes, clear any caching on your server, from any caching plugins (e.g., W3 Total Cache, WP Super Cache), and also your browser cache before testing the site again.
Conclusion
A WordPress Multisite loading an empty directory after a URL change is primarily a server configuration issue, not a bug in WordPress itself. The solution hinges on ensuring the new domain is correctly pointing to your WordPress installation before updating any settings within the database. By following the steps above—configuring your server, carefully reverting changes, and using a trusted search-and-replace method—you can successfully map your domain and avoid the dreaded empty folder.
Related Support Threads Support
-
WP Multisites point to empty folder directory when URL updatedhttps://wordpress.org/support/topic/wp-multisites-point-to-empty-folder-directory-when-url-updated/
-
Using google drive for web site links?https://wordpress.org/support/topic/using-google-drive-for-web-site-links/
-
How to change URLhttps://wordpress.org/support/topic/how-to-change-url-10/
-
Changed url, database error on some siteshttps://wordpress.org/support/topic/changed-url-database-error-on-some-sites/
-
Export+Import Blog contenthttps://wordpress.org/support/topic/exportimport-blog-content/
-
Best Practices with Subsitehttps://wordpress.org/support/topic/best-practices-with-subsite/
-
www. and multisitehttps://wordpress.org/support/topic/www-and-multisite/
-
why does WP store old site URLs and is it bad to “fix” them?https://wordpress.org/support/topic/why-does-wp-store-old-site-urls-and-is-it-bad-to-fix-them/
-
the update of wordpress plugin in subdomain not run normallyhttps://wordpress.org/support/topic/the-update-of-wordpress-plugin-in-subdomain-not-run-normally/
-
Changing from VHOST declaration in wp-confighttps://wordpress.org/support/topic/changing-from-vhost-declaration-in-wp-config/
-
Changing DocumentRoothttps://wordpress.org/support/topic/changing-documentroot/
-
Moving WP to new URL – Some things do not workhttps://wordpress.org/support/topic/moving-wp-to-new-url-some-things-do-not-work/
-
domain name renaming after setting up a networkhttps://wordpress.org/support/topic/domain-name-renaming-after-setting-up-a-network/