Skip to content

How to Change WordPress Multisite from Subdomains to Subdirectories Without Errors

I recently decided to switch this very WordPress multisite installation from using subdomains like hulihee.mikefclark.com to subfolders like mikefclark.com/hulihee. I think I read somewhere that using subdomains has a negative impact on your search ranking. I’m sure it’s debatable, but confrontation makes my tummy anxious so let’s drop it.

The process seemed simple enough. These two articles both recommended the same steps essentially:

Take note of that title: “How to Change WordPress Multisite to Sub-Directories or Sub-Domains Without Errors.”

The steps

These are the steps recommended in both articles. Don’t do these steps. They apparently don’t work.

  1. Edit your wp-config.php and change
    define( ‘SUBDOMAIN_INSTALL’, true );
    to
    define( ‘SUBDOMAIN_INSTALL’, false);
  2. Replace the code in your existing .htaccess file with the code recommended for a subdirectory installation of multisite. Just copy it right from the Codex.
  3. Use the Search and Replace plugin or, better yet, use the Better Search Replace to edit the URLs of your subsites in your WordPress database. And of course as soon as someone releases a plugin named Even Better Search Replace, definitely use that instead.
  4. Lastly, get yourself a cold Shasta. You’ve earned it, Champ. It may look short and squat compared to other name brand sodas, but it turns out it’s just the right amount of cola. Not too much and not too little.

The result

Not so good. I ran through steps 1 and 2 and though my mouth was watering for the smooth taste of Shasta, I persisted and used the Better Search Replace plugin to change the URLs of my first subsite. It took a long while for the plugin to crawl through all the database tables, and when all was said and done, the subsites were a bit of a mess. The home page of each subsite had an error, and I was unable to browse to any subsite’s dashboard. But, WPMUDEV, your headline promised me NO ERRORS.

Shasta still on my mind, I tried another angle. I found that if I used the Multisite Cloner plugin to clone an existing site that formerly had a subdomain URL, the site was cloned in a fraction of the time and worked perfectly, with all of the URLs on the subsite rewritten automatically. Needless to say, this would be time consuming if you have a hundreds of subsites. But it works. Without errors.

The steps that work

  1. Edit your wp-config.php and change
    define( ‘SUBDOMAIN_INSTALL’, true );
    to
    define( ‘SUBDOMAIN_INSTALL’, false);
  2. Replace the code in your existing .htaccess file with the code recommended for a subdirectory installation of multisite. Just copy it right from the Codex.
  3. Clone each of your old subsites using the Multisite Cloner plugin. It’s way faster and just works.
  4. When you’re done cloning, delete the original subsites.
  5. Don’t forget your Shasta, Big Guy.
Published inWordPress Multisite Tips

Be First to Comment

Leave a Reply

Your email address will not be published.