Multisite allows you to change the template of a '/blog' without affecting the template of the main domain, in addition to being able to manage two or more sites in the same administrative panel. This tutorial shows you how to enable this functionali
Requirements
Rock Stage hosting supports multisite using the subdirectory structure. For subdomains, you need to create a new WordPress instance. Don't know the difference between subdirectories and subdomains? Here we explain!
Accessing SFTP
To enable multisite, you will need access to the HTACCESS and WP-CONFIG.PHP files on your website. You will need access to SFTP - this article shows you how to obtain the necessary credentials.
Enabling multisite
With SFTP access, open the ‘wp-config.php’ file at the root of the site and insert the following code snippet:
define('WP_ALLOW_MULTISITE', true);
define('DISALLOW_FILE_EDIT', true);
define('DB_CHARSET', 'utf8mb4');
Configuring the wp-config and HTACCESS files
Once you enable the multisite environment, access your site's administrative environment to disable all plugins, and then go to Tools> Network Installation.
Choose the subdirectory option - today, it is not possible to create a multisite for a subdomain:
After that, a new screen will open with code instructions that you must insert in the wp-config.php and htaccess files.
Below is an example of the codes that must be inserted/replaced.
Wp-config
You must add the code below to the wp-config.php file, just above the line
/* That's all, stop editing! Happy blogging. */:
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'superb-cream-salto.blogs.rockstage.io');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
Attention: the line
define('DOMAIN_CURRENT_SITE', 'superb-cream-salto.blogs.rockstage.io');
need the website domain in single quotes.
HTACCESS
Use the code below to replace the code snippet within the tag <IfModule mod_rewrite.c>:
RewriteEngine On
RewriteBase /
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]
Save it.
Adding a new website
Within the WordPress administrative panel, go to My Sites> Network Panel> Sites:
Observation: It is impossible to create a new website like domain.com/blog, so you have to do it as /copies. Once you do that and save it, just click on edit and switch to /blog.
Changing a Multisite domain
If you are going to change the URL of your website at some point - for example, when you make the domain name - you must also:
1. Access “wp-config.php” via SFTP and change the code entered for the new domain;
2. Change the old domain with the new one in all tables in the website database: our suggestion is to use massive change plugins, such as Better Search and Replace.
To learn more about managing your WordPress Multisite, just click here.