Few days ago, I was trying to enable WordPress Network (Multisite) feature on one of my old WordPress site as WordPress 3.0 and above are having inbuilt (but hidden) Network feature. When I started that site, there was no need to have multiple sites with their own dashboard, posts, pages etc. but later on I thought to have different sites with one Network Admin control. This way I can let others manage different sites with different content and also monitor all of them with Network Admin control. The site was few months old and when I injected the below mentioned code in wp-config.php file to activate the Network,
I got a message on network page saying,
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.
I was sure that I don’t need sub-domains for my new sites but I wanted sub-directories only. So that I can actually forward the backlinks and Google PageRank easily to my new sites. But since my site or say Installation was more than 1 month old, WordPress was not allowing to have sub-directories. The reason behind it is that when you opt for sub-directories, WordPress actually adds a term “/blog” at the start of your site’s permalink structure. And if you will enable the sub-directories structure of Network sites, you may break the old permalink structure and may lose old backlinks and Google PR juice.
But as I was not using the site to get traffic from search engine, I was sure to have sub-directories only. Finally I got the simple solution to get that.
So what is the solution?
To have sub-directories structure on old WordPress installation while activating the Network feature, you just need to add the following code in your current theme’s functions.php file.
add_filter( 'allow_subdirectory_install', create_function( '', 'return true;' ) );
That’s it. Now reload the Network page from Dashboard and you will see option to choose between sub-domain and sub-directory. Once you complete the Network activation process by adding the wp-config.php and htaccess code suggested on next page on Dashboard, you may remove the code from functions.php or even can change the theme template.
I hope this simple tutorial helps you in getting sub-directory structure on WordPress Network site with old installation.
I spend most of my time around WordPress and related plugins. It is almost impossible to resist myself from sharing good tips, tutorials and updates related to the platform. After all, I am a blogger by passion.
Thank you this worked perfectly!
Thank You, SANJEEV MISHRA.
You saved my day!
I followed this YouTube Tutorial – https://www.youtube.com/watch?v=GwGC-_KH0jY – but stuck on the same thing! I couldn’t add sub-directory as a Network!