In today's WordPress hack we're going to show you how to create a multisite.
There are two kinds of multisites. The ones that use subdomains: blog.yourdomain.com and subfolders: yourdomain.com/blog
To create a WordPress multisite, first thing you need to do is add the following code to the bottom of your wp-config.php file:
/* Multisite */ define( 'WP_ALLOW_MULTISITE', true ); |
When done, you need to open your admin Dashboard and deactivate all the plugins.
Next, hover Tools tab on the right and click on Network Setup.
Choose either a subdomain or subdirectory structure for your multisite. After that, you can enter your network name and your admin email or keep the default ones.
In the window that opens you’ll see the code to put into your wp-config.php and .htaccess files. Both files are in the root folder of your installation.
Keep in mind that you need to ADD code to wp-config.php and REPLACE the code in .htaccess.
I've added the sample code below but it's better to use the specific code WordPress gives you.
This is the sample code for wp-config.php:
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', yourdomain.com'); define('PATH_CURRENT_SITE', '/your_sub_folder/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); |
And this one to your .htaccess file:
RewriteEngine On RewriteBase /your_sub_folder/ RewriteRule ^index\.php$ - [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] |
This code should be the only thing left between # BEGIN WordPress and # END WordPress tags in the .htaccess file.
You can log in back to your website now. And you’re done, your website is ready to be a network.
Now let’s see how to add subdomains to your website’s network.To use subdomains on your multisite, you need to configure wildcard subdomains.
Basically, if you don't want to set up each new subdomain separately, create one with an asterisk (*) for the subdomain. Also, add the location of your root WordPress installation.
To use subdomains, your main WordPress installation needs to be in the root folder of your server, a.k.a ‘public_html’. If you’re creating a network from a subfolder, like I do, you will only be able to use other subfolders.
Some hosting accounts don’t support subdomains. Then you need to either upgrade your hosting plan or switch to another provider. For example Bluehost or InMotion Hosting.
Feel free to check this tutorial from our support dept for an even more detailed explanation. Also, don't forget to comment below if you have anything to add about creating a multisite on WordPress.
Visit our store to see the richest collection of WordPress templates on the web.
[mc4wp_form id="74928"]Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.
Leave a Reply
You must be logged in to post a comment.