How to Force Multi Site to Use Subdirectories

One of the most common issues to afflict most web developers who try to enable WordPress Multi Site is WordPress’s insistence that subdirectory blogs cannot be setup. The message WordPress throws up to show its dominance over afflicted web developers is:

Because your install is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.

And the first thing afflicted web developers do is… they scream at their computers “What the f**k is that supposed to mean?”

Seriously, what is it supposed to mean?

The next thing they do is Google for answers. I know this because I tried both strategies before I bit the bullet and re-installed a very large WordPress installation. Some of my search terms were:

  • Can’t enable multi site subdomains
  • WordPress won’t allow subdomains
  • How do I enable subdomains not subdirectories in WordPress
  • How do I force subdomain use in WordPress MS
  • WordPress subdomain subdirectory installation problem multi site

If you followed the same path as me and eventually, after re-installing WordPress, returned to the Multi Site activation screen you would know that re-installation, contrary to what is indicated by WordPress’s message, is not the solution. No, what WordPress is trying to say in a convoluted way is not that the WordPress installation is too old for Multi Site to be enabled for subdirectories but something else. Here is a translation of its message:

The URLs of some of your blog posts might conflict with the URLs of the subdirectory sites you create when Multi Ste is enabled therefore it is advised that you do not enable subdirectory sites.

Why the hell the WordPress development team use such cryptic error messages that require translation is, well, a Universal mystery.

In short, if a WordPress site is more than 30 days old, WordPress will try to prevent its multi-site conversion from using subdirectory addon sites.

There is a workaround to enforced subdomain addon site installations. Yes, we can fight back and force WordPress to allow subdirectory sites.

Force WordPress to Allow Subdirectory Blogs

During the activation of Multi Site a few lines of code need to be added to wp-confg.php. One of those lines states:

That line tells WordPress to use subdomain addon sites.

Change it to

and you will now be able to create subdirectory sites.

Currently, WordPress messes around with subdirectory site URLs. It adds a /blog/ slug after the TLD. For example, if a subdirectory site is created with the name “apple” such that its URL should be

then WordPress renames it

Now that does not look very professional. In fact, it looks pretty damn ugly. Thankfully, the “blog” slug can be removed. A plugin is available from ThinkingWordPress (direct link) which does just that – it removes the ugly “blog” slug.

There are Two Snags with All This

Forcing WordPress to allow subdirectory addon sites on old WordPress installations has a price:

  1. Subdirectory sites that resemble existent post, page, tag, category or directory names must not be created,
  2. Some subdirectory sites will not display as they should because of conflicts with the main site’s permalink URL structure.

The solution for the first issue is simple:

  • Do not create addon sites with names the same as existent WordPress slugs.

The second problem is characterized by any of

  • Subdirectory sites do not display when viewed
  • Subdirectory sites display but their themes are corrupt (missing CSS files)
  • Subdirectory site backend admin panels redirect to the main site’s admin panel

Other symptoms will probably exist also.

The solution is simple and involves changing the Multi Site’s URL rewrite rules.

Edit your .htaccess file and replace

With

And that is all there is to forcing WordPress to allow subdirectory addon site installations when Multi Site is enabled.

The Blog Slug

WordPress will insist on inserting a blog slug into the sub-directory URLs such that my-blog.tld/site-one/my-post will look like my-blog.tld/blog/site-one/my-post. This can be removed with the Remove Blog Slug plugin from here.

Leave a Reply

152 Comments on "How to Force Multi Site to Use Subdirectories"

Notify of
Sort by:   newest | oldest | most voted

Hi, thanks so much for this, its been so helpful and I am so close to solving my multisite problems. I have followed everything you wrote and managed to get my second site to work as a subdirectory (/dj/), I can add pages in the admin, but when I come to view them it throws a 404.

Basically I am trying to view “http://quirksmode.dev/dj/” and my error is saying “You tried going to http://quirksmode.dev/dj/dj/ and it doesn’t exist.”

For some reason it is duplicating /dj/ do you have any ideas how I may solve this?

It’s all good, I fixed it. I had a remove category base plugin that needed to be disabled and reactivated to kick in. Thanks so much, you are a legend!!

One last thing, I don’t suppose you know a plugin that allows me to move posts/pages from one site to another within my network?

Hello David, glad to hear you resolved your problem. I don’t know of a specific plugin that’ll allow you to directly transfer a post or page from one site to another within your network but I do know you can export posts and pages from one site to another via a WordPress export file. Visit Tools>Export in your Dashboard to learn more about it. I recently read on the WordPress support forum that the ability to move posts and pages directly between sites without downloading and uploading export files is a commonly requested feature; maybe the WordPress developers will put… Read more »

David, I think I have a plugin you might be interested in:

WordPress MU Sitewide Tags.

I haven’t tried it. It’s supposed to do as you want to do. Whether or not it does is another matter. I read about it here.

Have fun :)

Nice article Dion. I am planning to create new channels of my blog and right now, utilizing the multi-site feature of WP 3.0 seems to be the best way out, except for one snag – Google XML Sitemaps plugin doesn’t work in that mode. And it is quite an important plugin as far as I know.

I did search for alternatives, finally found one called XMl sitemap feed, something like that…but that didn’t work as expected. It gave errors and all.

So, that is what is stopping me from enabling the multi-site feature. Can you help?

Thanks,

Abhijeet

In fact I just saw that you are using the same plugin I was talking about. And it appears to have the same issue – https://journalxtra.com/sitemap.xml gives errors when I try to load it.

LOL, I see what you mean. Try viewing it in a different browser – sitemaps aren’t supposed to be viewable by web browsers so sometimes they load in them and sometimes they do not. the important point is whether they are readable by bots. As far as I’m aware mine is (was the last time I checked). I’ll recheck in a minute and post back.

Hello Abhijeet, XML Sitemap Feed does work. It had a few issues initially when Multi Site was first released but there have been a few updates since. Retry it and remember that it produces a virtual sitemap so move the old sitemap from your blog’s root directory (rename it) and use the KB robots.txt plugin to direct search engines to your new sitemaps (add something similar to “Sitemap: https://journalxtra.com/sitemap.xml” to your virtual robots.txt file (no quotes)). I suggest the kb robots.txt plugin because each virtual site requires its own robots.txt file and the best way to create one is to… Read more »
Here’s a thread I posted on WP support forum – http://wordpress.org/support/topic/xml-sitemap-feed-plugin-problems ..check what the plugin author has to say about caching and all. I gave your site as the example there. :) I use Robots Meta plugin already. Should I still go for KB robots.txt? And are you sure that each new site would need it’s own robots.txt? I was told by someone, who owns a huge blog with different channels, that he only has one robots.txt but different sitemaps. Although, he uses sub-directories and has separate WP installations in them. So I thought it should be more or less… Read more »
I’ve just looked at and replied to that thread. Google accepts the sitemap. I’ve just re-submitted it to double check it. Regarding robots.txt, robots.txt is read by bots if encounted in subdomain and root directories but is ignored if encountered in subdirectories. If you use subdomain sites and want to specify different rules per site (e.g. for sitemap locations) then you will need a plugin to control the output of each site’s robots.txt file which is dynamically created by WordPress when requested by bots. Two other ways to direct search engines to your sitemaps are, 1, add a link to… Read more »
So that means, since I’d be using sub-domains, I don’t need to worry about robots.txt, right? ( and yes, Robots meta does work in multi-site mode..I guess I just need to network activate it). I cannot see your reply on that thread for some reason. Hence I’ll ask you here. Do you use W3 total cache? Did you configure it separately for each of the new blogs you added? Another question – did you a notice significant changes in your search traffic after you shifted to the xml sitemap feed plugin? I just wanna be absolutely sure before I shift… Read more »
If you install your sites in subdomains you will need a robots.txt file for each site; if you install your sites in subdirectories you will (as far as I know) not need a robots.txt for each site. I usually create them for all my sites, just in case. I do use W3 Total Cache. I did configure it separately for each site. The plugin’s Multi Site version is awkward to set-up because it doesn’t automatically create the directories it requires to store cached files; also, it doesn’t automatically edit the .htaccess file. It is also the caching plugin recommended by… Read more »

Just to let you know, WordPress MS creates a separate virtual robots.txt file for each site it serves. Remember that when you use a plugin that creates a virtual robots.txt or sitemap.xml for each of your sites you must not have a non-virtual sitemap.xml or robots.txt file stored in your root site’s (or other sites’) root directory.

Ah, Dion, I am confused again. :) Could you please check out that WP thread again – http://wordpress.org/support/topic/xml-sitemap-feed-plugin-problems , especially the conversations I had with RavanH towards the end. I basically need to know what are the steps I should follow. Here’s my current position – I have a WP blog, WP version 3.0, it has a manually created robots.txt and a sitemap.xml created by the google xml sitemap plugin. Now, I need to enable multi-site mode and add 1 or 2 blogs in sub-directories. Since google xml sitemap plugin doesn’t work in that mode, I need to ensure that… Read more »
Hello again, I wondered when you’d post back. I understand your confusion. The steps you have outlined are the ones I would follow. RavanH knows more about sitemaps than I do and his suggestion seems to concur with those provided at Sitemaps.org. Because you are using sub-directories instead of sub-domains, RavanH suggests you reference each of your sitemaps in your robots.txt file by adding a line similar to Sitemap: http://www.example.com/sitemap.xml to the end of your non-virtual robots.txt file for every sitemap you have. As a further example, if you have three sites then you should add three references to sitemaps… Read more »

OK, cool. So we now have both the experts (you and RavanH) on the same page, and I know exactly the steps I need to follow. Good. :)

Yeah, I am on a shared server, but the traffic isn’t that much. The site is only 6 months old. Plus I am planning to move to VPS next month anyway. So I think it’d shouldn’t be a problem. But thanks for informing me.

Thanks again Dion for your prompt replies. Really appreciate it. I’ll report back when I have the process done, which I think should be this weekend.

You’re welcome. I look forward to hearing how you get on.

Works excellent , thanks you really very much , I can’t imagine how many days I should spent to resolve this problem without you. Gotta say that I have changed the subdomain installation to subdirectory (so NO new fresh installation ) and this thing seems that works too.

You’re very welcome Danial. Remember to bookmark JournalXtra for when you have other WordPress needs :)

Thanks for this post. Works like a charm.

You’re welcome.

This page: http://codex.wordpress.org/Create_A_Network says: “You cannot choose Sub-directory Install in the following cases: * If your existing WordPress installation has been set up for more than a month, due to issues with existing permalinks. (This problem will be fixed in a future version.) ” Does the above this this issue? Or can I still not transition my current set of individual WP blogs (using subdirectories) to WP 3.x multisite, using subdirectories? I would love to move to WP MS if this issue has been fixed by the above code (it’s not clear to me). Thanks, this is a great tutorial… Read more »

The above guide addresses that issue so, yes, you will be able to force WordPress to use subdirectories with the above guide. Be careful before migrating to WordPress MS. If your sites are CPU/memory hungry and you’re on a shared server then WordPress MS might not be the right solution for you.

Cool, great to know. Thank you!!

Hi, I was just working with a site that has this implemented and had broken somewhere along the way. Failing to find and fix the problem, we’ve implemented the whole network and forced subdirectories anew, and it almost all works except that the dashboards of all the sub-sites have no CSS or images (actually the sites themselves have no style from the Twenty Ten theme either). All the image and stylesheet URLs have the site slug in them rather than being located at the root of the network. So they’re NETWORK_URL/site-slug/wp-admin/css… instead of NETWORK_URL/wp-admin/css… Have you encountered this? Have you… Read more »
Hello Kristarella, welcome to JournalXtra. I had the same issue until I implemented the second list of re-write rules stated in the post. The only suggestion I have is that you check your re-write rules. Possibly use a near blank .htaccess file with only the DirectoryIndex index.php line and the essential WordPress re-write rules stated above. Another possibility is that a plugin is interfering with the sites’ display. If neither the aforementioned work, try mirroring some of the network in a fresh WordPress installation in subdirectory (new database with a couple of sites exported to it) to see whether the… Read more »
Hi, Worked great on an “old” new site that we hadn’t posted content on yet. I’ll let you know when we try to migrate an existing one. Thanks a lot for your guidance. The only thing I could add is that when you go to Tools>Network, that’s when it’s going to ask you to “Install”, with only the subdirectory option. After you hit “install”, that’s when you update your wp-config.php file and your .htaccess files to your given code. I wasn’t sure whether to hit “install” when it only gave the subdirectory option. I went ahead and did, then was… Read more »

Hello Hunter Gatherer. I’m glad it worked for you. Thank you for pointing out the detail I missed. I’ll update the guide accordingly :)

After following these directions now all the posts/pages/etc. on my main site redirect to the main site’s index page. Any idea why this would happen?

I reckon you’re using the Redirection plugin. Go to Redirection>Groups>Modified Posts then delete all redirections that show as a forward slash (/) only. If not the redirection plugin then it’ll be something similar. Please post back with your results whether good or bad.

Can’t seem to find anyone else having this issue. I “deactivated” multisite for now until I can find a solution.

I do have that plugin but I had it disabled. The problem specifically happens after modifying wp-config.

It’s a 302 redirect. Still trying to figure out why.

I have found the problem to be when changing

define( ‘SUBDOMAIN_INSTALL’, true );

to

define( ‘SUBDOMAIN_INSTALL’, false );

I can go through the steps perfectly but when I change this value to ‘false’ every page http://MLTnews.com/* is redirected back to http://MLTnews.com. When I change the value back to ‘true’ it does not redirect.

Any ideas?

I’m just about to goto sleep. I’ll quickly reply before I do. It is a strange problem you’re having. I would reactivate the Redirection plugin and make the changes I showed earlier. Even try your site with as near empty an .htaccess file as possible. If you use DirectoryIndex index.php then leave that as the sole line in it. Remember to back up your.htaccess file before editing it. If none of the above help it will be a process of elimination. I would start disabling and re-enabling plugins individually. If you’re not worried about disabling all plugins simultaneously then re-enabling… Read more »

The only other code in the .htaccess was for W3 Total Cache but I have deleted that temporarily for testing purposes here. I haven’t gone through and reactivated each plugin one by one but the redirection happens when all are deactivated as well as when all are activated.

I will try reactivating them one by one.

Temporarily change your permalinks to the WordPress default and see what happens. Backup your original settings so you can easily restore them after testing.

Also, use the contact form (see menu bar above) to send me a copy of the edits made to your wp-config file. Please do not send the whole document, I don’t need your database details :)

I’ve found that the redirects don’t happen when I have it on default permalinks but if I change it to anything else it redirects. I’ve also been having a discussion in the WP.org forums here.

Hello Dustin, I’ll reply here as well as at wordPress.org for the benefit of others. You said the /blog/ slug still shows in the backend. It will. That’s normal. It does this with my test blogs and with those I install for others. I’m now stumped as to what to suggest. It’s good we’ve established it’s a permalink issue. But knowing how to fix it is something else. I’ve had a few problems with WP MS that have required me to re-install to get it functioning as it should (unrelated to forcing sub-directories). Those problems were created by plugins. Maybe… Read more »

hey thank!  had similar isssues,and while the first htaccess post didnt work, THIS one did.

ty ty ty ty. I cant thank you enough.

I’m in agreement with you that I tried all the things you mentioned above.

No luck on that new .htaccess. Same results. I’m moving towards backing up/exporting my current WP installation (around 1,000 posts), doing a fresh install and then importing all the posts/pages after I set up multisite.

Just a question Dustin, do any of your post titles conflict with you subdomain names?

Backing up and re-installing can be a tedious job. It’s not always perfect either. Have you done it before?

Given your current problem, I wouldn’t use the original database. I’d keep it so I could export components of it e.g. the tables for certain plugins.

I hadn’t even made any additional sites on the network yet. Just the main one.

Does your hosting plan allow addon domains? If so, I can point one of the domain names I use for test sites toward your server so you can create a mirror of MLTnews to test that re-installation will fix it. If you want to do this, join me on Facebook and I’ll set it up. It’s easier that way than by posting multiple comments here. Attention other readers: I’ll write up the solution for others once one is found. My Facebook profile ID is http://www.facebook.com/DionDeVille

Actually, if you do the change in wp-config to switch the type of install, you can get the new rewrite rules by visiting the backend. They’ll switch. ;)

Thanks for that information Andrea. I would have replied sooner but I’ve been away and neglecting my duties. I need to update the guide a little, I’ll do it during this week. Have fun :)

Hi Dion, Well, I tried the process on an existing site. The content is not critical, so if I have to reinstall things, it’s not a big problem. This is what happened: 1) I did all the instructions: edited the config; edited the htaccess; uploaded everything: 2) Went to Tools>Network 3) The only offer was subdomains 4) Installed 5) Got the screen with the codes and salts: installed them in the appropriate files; edited config for subdomain false; change the .htaccess; completed the process; 6) logged out 7) logged in 8) SuperAdmin present 9) Add site> added a couple of… Read more »

Hello HG, try the default theme and report back.

Hi Dion,

Tried Default theme, Same story.

HG

Hello HG, this is an issue I’ve not hit before. Brendon, who commented below is also suffering the same. I need to do a bit of research. In the meantime, check your server error log for the site; there might be a clue to the cause in it. It would help if I could access your site to look over a few backend settings.

I am having a similar issue to HG. Took exising WP Blog and Added Network feature with subdirectories.

Added 2nd site: blog.kaseya.com/fr but domain mapped it to blog.kaseya.fr

Only some people can actually see the blog (which is just generic) and I can’t get the dashboard for that site at all.

The original dashboard has all the Super Admin stuff, but I can’t get to the dashboard for the new blog. Can’t change theme or anything.

Wondering if there is a permissions issue or some other PHP mod I missed somewhere.

Thanks in advance for thoughts.

-brendan

Hello Brendon, I’ll say the same as I have to HG. I need to do a bit of research. In the meantime, check your server error log for the site; there might be a clue to the cause in it. It would help if I could access your site to look over a few backend settings.

Hi Dion,, Thanks for following up. Since my site had only a minimal amount of content, I decided to just do a complete re-install with a new database. I ran into a few problems along the way, but ended up over at the WordPress forum on Multisite. Among other things, I couldn’t log in; got no SuperAdmin, etc. and had to do the cycle a few times. The easiest part was getting away from the white screen of death. Andrea Rennick helped me. She did mention this problem a number of times on other threads. Just start a thread. I… Read more »

I have three blogs running on my domain. I think multisite allows control of the sites from a superuser to manage the multi sites.
I’m actually looking for a way to have the page rank of all the pages/posts on the three blogs count toward the page rank of the main site.
Do you or any of your readers have any ideas if this can be achieved please?
Reg

You would need to link from all pages to your main site’s home page. You’re home button and logo will link to the home page of each site. Add a link to your main site in the footer area of all sites (displays on every page). Most search engines read a limited number of links per page before they stop following them (I think it’s something like 30 links) so be if your pages might contain a lot of links, link to your main site from the header or menubar of all networked sites. Generally speaking, page rank is not… Read more »

You are a genius! Thanks so much for sharing this with everyone.

Hi, I just installed WP 3.1 in Arvixe account and my plan is to have multisite installation. So, I followed the steps given on WP.org for multisite installation. I did the steps:- 1. adding one line in wp-config.php. 2. Logged In and select sub-directories as option and then added 2 new folders in wp-admin and added more lines in wp-config.php. 3. But at that time, I do not have .htaccess file so I tried in web.config and it did not work and so I reverted back. 4. I logged into the site and I could see network admin and all.… Read more »

Hi Mehul,

I’m assuming you’re using a Windows server. Correct me if I’m wrong.

Did you use the replacement re-write rules that I’ve stated in the post above?

Have you been with Arvixe for long? If not then I would consider moving over to Hostgator on a Linux server where WordPress is supported out of the box. Hostgator have a one click install that sets up 3.1. Plus, you can host unlimited domains under one hosting account. Check out their baby plan which currently has a 20% discount.

Hi, Yes, I have put the replacement rules like: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ – [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L] RewriteRule . index.php [L] # END WordPress Also, I have been using Arvixe for ASP .net application and now we thought to have same hosting provider for wordpress, so we installed wordpress. In the above rule, when I put in remote IIS server,… Read more »

Hi,

This is fixed in windows server as I followed the rule given at the link:
http://www.lauragentry.com/wordpress/?p=517

WordPress hosted on windows server, please use the rule given at the link:
http://www.lauragentry.com/wordpress/?p=517

Thanks,
Mehul

I am very glad you found a workable solution and thank you very much for posting a link to a page where the solution may be found.

Thanks, this solution worked perfectly!

When I follow these instructions I am then unable to log in at all. What’s wrong?

Hi Lukeradi, it’s most likely an htaccess rule that’s the issue. If it works with a blank htaccess file then you will need to look at the current file for errors.

Before I can give any other suggestion I need to know whether you can you see the front end of the site and whether it’s only the admin section that’s inaccessible. Do you get any error messages?

Thank you so much, I was seriously stuck and you fixed it all!!!!  thank you thank you! 

Matt, you are welcome. Please share this and please look around at my WordPress .htaccess hardening posts because I’m sure you will find them useful.

I hacked the code to enable subdirectory installation.  1 line and that’s it.  Installation was flawless.

add the following line in
“wp-admin/network.php” at line: 66

return true;

Thanks Henry :)

Is that the full line or was some of it removed by the comment system. You can use code tags if needed.

Hi Dion,

I’m at it again on a another site.  I forgot the whole process and found your page again.  I’ll follow your instructions and give it a go.  I’m glad you’re still here.

Thanks,

HG/mws

Hi, good to see you back. Let me know if you need any help :)

Thanks a bunch for your help.  I can’t believe how relatively easy this was thanks to you.  I took an old site that had just been sitting there, moved it to a network install and got buddypress up and running in minutes.  Without you it wouldn’t have happened until Andrea straightened it out.  That code eliminated the 404’s in an instant.

You’re on the top of the heap.  Thanks again…

You’re always welcome and I’m glad I could help.

Hi Dion, Most of it went okay.  No major installation issues.  But I do have a problem viewing the pages.  All of them, other than the site’s home are showing as 404 errors.  I put a BuddyPress over it, went through the normal BP configuration; it created pages and navigation; but nothing shows up.  I took BP off and it does the same thing and I can’t get to any real pages.  The error reads Error 404 – Not found Your browser can’t find the document corresponding to the URL you typed in. Got any ideas where I went wrong… Read more »
Recreate the wildcard DNS record for subdomains. BuddyPress sometimes upsets the server. I don’t know why it does it but it’s happened to me a few times: as soon as I activate BuddyPress on any site hosted on the server this site is on, my server forgets the wildcard DNS so WP can’t create subdomain sites. At which pint I’m forced to delete the wildcard and recreate it. If recreating the wilcard DNS record fails to solve it, do you have a redirection plugin installed and are we working with an .htaccess file that contains only the WordPress rewrite rules… Read more »

Thanks for the quick reply.  I must not have been clear; 

I set it up as a subfolder install; not subdomain.  I’m sure that has something to do with it. 

What are your .htaccess rewrite rules? Place them in pre or code tags when you post them in the message.

They look like this:

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]

# uploaded files
RewriteRule ^files/(.+)

wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule . index.php [L]

Try these:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress

Do you have any plugins installed that might interfere with the way WordPress writes permalinks and have you been to Settings>Permalinks to save them again?

You are a frigging Wizard Dion.   Worked like a charm…

I know, I know but don’t tell everyone :D

Here’s something you’ll like to know: when using multi-site, install and network activate the Proper Network Activation plugin. Some plugins fail to properly activate across a network when network activated, this plugin forces them to activate properly.

Have fun with your new site. Let me know if you need more help  :)

Yes,!!!!! You so fking cool man!!! You really save me days fighting with this cumbersome!

I’d like to do what this post describes, but my wp-config.php file contains no such line:
define( ‘SUBDOMAIN_INSTALL’, false );

Any help?

Hi Rusty, that line won’t be present until you put it there. Follow this well trodden guide to enabling multisite then return to this page to force the subdomain install.

Let me know if you need further help and I’ll be happy to oblige.

though not directly related, this is similar, and not finding any resolve.  WordPress MU Using Wildcard DNS wildcard DNS and new account creation work good Issue: RSS on tld works using feedburner –> http://tld.com/feed RSS does not find a feed on sub.tld.com/feed  it merely reloads the page.  Posts on sub.tld.com Permlinks issue when using custom permalinks Posts permalinks are not working, they bounce to 404, though when you call the posts permalink, the structure all looks correct parsing /%year%/monthnum%/%day%/%post-name%/ when changed to default permalink posts permalinks work. so kind of a compound issue here, one may or may not be… Read more »
Hello John, take a look through your .htaccess files in the WordPress installation directory and directories above it. I’ve a feeling you have a rewrite rule that’s preventing the RSS feed from displaying. Do you have a rewrite rule to remove the www hostname? WordPress automatically resolves that and placing such a rewrite in your .htaccess will cause problems in a multisite installation. Also, check for redirects in plugins like “Redirection”. Plan of action: 1) Disable all plugins used anywhere within the Network 2) Check whether pages and the RSS feed still 404. 3) If they do 404, check all… Read more »

Rly gj ! tnx !

Dion, Thanks! As others have said, you have made the inexplicable very easy. Haven’t touch Multisite for about 18 months, now building a new collection of sites and your post saved me HOURS!

One question for you. . . my main WPsite is at mydomain.com, and I want all my subsites at sub.mydomian.com/thissubsitename. Does this mean I need a single-site version of WP on mydomain.com, and then a MS version at sub,mydomain.com?? Or can I work some htaccess magic to make this more sane?

Thanks again for all you help!

Cool it works :) thank you for the post!

you saved my life

Brilliant post, this worked perfect, keep up the good work.

I had no idea what I doing, and this was an enormous help. One suggestion – move Hunter Gatherer’s comment (from 2 years ago), regarding when to include the ‘false’ statement. I was very reluctant to hit ‘install’ before reading that comment. Many thanks.

Works great, thank you very much! I was able to change my subdomain installation to subfolders using this.

I enabled the 3.0+ network only with one line, define(‘WP_ALLOW_MULTISITE’, true);
I can’t choose subfolders, and I like to have that (it’s a must)
If I add the line from the post I got a “site doesn’t exists on the network” message. Anybody has the same? Maybe it’s from an outdated activation? Help please if you can!

Hi Lee, Fantastic information, which allowed me to implement sub directories despite WordPress telling me I couldn’t. A bit scary at first for me uploading this as I don’t use FTP that much and to be honest , not really au fait with directories and files. But I got there in the end, so Many Thanks. One problem I have come across is that when viewing Themes, the option to delete the theme has disappeared! Any ideas??

Best Regards,

Gary G

Hi Lee, thanks for this clear post. Very helpful indeed! I currently have a WP Multiside with 5 subdomains that I’d like to change to sub-directories because of better Google searchability. How now do I move the contents from the subdomains to the sub-directories? I was thinking to just change the urls both at the WP-MS admin part and the physical directories via FTP. Who that do it?
Thanks,
Caspar

Thanks Lee. I’ll first try myself. Three questions though:

If I change subdomain install to false, will the subdomains and the site actually still be active as such? In other words can I run this operation in parallel with the existing sites still functioning?
Can I keep using the multisite install?
What are 301 redirects?

thanks again

Hello Lee,

It’s me again. I managed to move from subdomains to directories. Yet since there are no virtual subdomains anymore I tried 301 redirecting the old virtual subdomains to the new directories. When I enter the old URL it redirects to the primary domain only and not to the new subdirectory. Any idea how I can fix this? If you want I can send you my .htaccess.
Cheers

I used wordpress 3.5.1 and tried the step you gave as I want subfolders, not subdomain on my 1 year old site.

But after editing the config & htaccess as instructed, and log again as WPMU told me to do, I get the error that the site cannot connect to the database.

Do you know what I did wrong ?

Good Tutorial

Adding the ‘subdomain_install’ line and setting it to false causes the site to show: “No site defined on this host. If you are the owner of this site, please check Debugging a WordPress Network for help.”

Removing .htaccess doesn’t help.

Any ideas?

How does wordpress know how long the site has been installed for?

Hi,

I have this issue and try to follow your instructions. But i dont find the: define( ‘SUBDOMAIN_INSTALL’, true );

and when i paste it, also tried with: define( ‘SUBDOMAIN_INSTALL’, false ); in the file wp-config I get an error message, after i uploaded it, thats related to the server.
its like the whole admin system shuts down.

What do I do wrong? Where shall i Put it?

Thanks a lot

This is the messade: No site defined on this host. If you are the owner of this site, please check Debugging a WordPress Network for help.
Saw you answer above and its not www before, do you know what i can do? Thanks a lot!

Lee, do you have an answer for me also? Please

Hi Leia,
Sorry for jumping but since I resolved the issue on my site I am very eager to help you.
If you don’t have the SUBDOMAIN_INSTALL mentioned in your wp-config, are you sure the site is the multisite. Please verify that you are referring to the correct wp-config. I wrote about my success story and would be glad if you find it helpful. Please read below and let me know.

http://tipscow.com/steps-to-change-wordpress-multisite-from-subdomain-to-subdirectory/

Cheers!

I have a multisite at this point with subdomains.
I am having bad time doing seo for the subsites so i am planning to change it back to either subdirectory multisite or categorized url with single site install. But wondering if either of the two would cause me any trouble.
Please help me take a decision on subdirectory multisite or plain wp install with category in the url to appear like subsites.
Thanks

Hi Lee, Thanks for your reply! Appreciate your instant response. I buy your suggestion of using the plugins you suggested for Multisite. For your information, last night I was very curious to change my subdomain url structure to subdirectories. The site is still Multisite and the procedure was very simple. Just a few updates and the site was ready with the new structure in about 1 hour. There is no need to do any migration, etc unless you are changing your main domain or the hosting server. I also wrote about the success story in my blog that I will… Read more »

I’ve followed your post. I’m running 3.5.2. It was a new install that I imported posts from another website. I can access the admin menu no problem but when I visit the site I get a 404 error. I’n not sure where I am going wrong. My design isn’t uploaded yet and all my plugins are turned off. Do you think my importing my posts set my site as “old”?

http://yeahletsgo.com/atlanta

Nevermind I found the problem. GoDaddy created a folder in my root file that was empty. I deleted it and it fixed everything.

Hi Lee,

Thanks for this – it worked like a charm, however, url’s without a trailing slash aren’t working in any of the sites that are created in subfolders.

ie domain.com and its subsequent pages work with and without trailing slash (domain.com/page domain.com/page/)

but on domain.com/subsite a trailing slash is required. without it the page redirects to domain.com

any ideas? it’s probably something in the .htaccess

thanks!

Lee, thanks for getting back to me. Your solution does seem to work, however it breaks the CSS of the subsite. Any suggestions? Much appreciated!

You could also just delete the default page and post that gets installed with wordpress (and remove from trash as well). Then it will let you choose sub-directory.

Free to your inbox

Join our mailing list to receive the latest news and updates from JournalXtra.

You have Successfully Subscribed!

11 Shares
Share
Tweet
Reddit
Stumble
WhatsApp
Email