Applicable to:
- Plesk for Linux
Question
How to set up WordPress Multisite in Plesk using sub-directories?
Answer
-
Go to Domain > example.com > Install WordPress;
Note: This step can be skipped if WordPress is already present on the domain.
-
Make sure Multisite feature was enabled after WordPress installation in Domains > example.com > File Manager > wp-config.php:
Before:
CONFIG_TEXT: /* That's all, stop editing! Happy publishing. */
After:
CONFIG_TEXT: define('WP_ALLOW_MULTISITE', true);
/* That's all, stop editing! Happy publishing. */This line enables multisite network feature.
-
Log into WordPress through Domains > example.com > Log in;
-
In WordPress Administrator Dashboard open Tools > Network setup;
-
Set Addresses of Sites in your Network to Sub-directories and click Install;
-
Copy the suggested configuration and add it in Domains > example.com > File Manager for wp-config.php and .htaccess files.
This is an example for wp-config.php:Before:CONFIG_TEXT: /* That's all, stop editing! Happy publishing. */
After:
CONFIG_TEXT: define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'example.org');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy publishing. */This is an example for .htaccess file:Before:CONFIG_TEXT: # BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPressAfter:
CONFIG_TEXT: # BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<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]
</IfModule>
# END WordPress -
Set up additional directives to enable Multisite redirects:
Note: nginx serves dynamic content when Proxy mode is present and set to disabled state in Domains > example.com > Apache & nginx Settings:
In case dynamic content is served by nginx- Log into Plesk;
-
Go to Domains > example.com > Apache & nginx Settings;
-
Add the following to the Additional nginx directives:
CONFIG_TEXT: rewrite ^/([_0-9a-zA-Z-]+)/wp-admin$ /$1/wp-admin/index.php;
rewrite ^/([_0-9a-zA-Z-]+)/wp-admin/$ /$1/wp-admin/index.php;
rewrite ^/([_0-9a-zA-Z-]+)/((wp-(?:content|includes|admin)).*)$ /$2 break;
if ($request_uri !~ "^/(wp-(?:content|includes|admin)).*") {
rewrite ^/([_0-9a-zA-Z-]+)/(.*\.php)$ /$2 break;
}
set $test "";
if (!-e $request_filename) {
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
set $test "${test}C";
}
if ($test = PC) {
rewrite ^/.*$ /index.php;
}
In case dynamic content is served by Apache Web Server- Log into Plesk;
- Go to Domains > example.com > Apache & nginx Settings;
-
Disable Smart Static files processing (if present) and Apply the settings.
-
Re-login to the WordPress instance as an administrator in Domains > example.com > Log in next to WordPress instance
- Go to My Sites > Network Admin > Sites:
- Create additional sites in the WordPress network by clicking Add New:
Comments
0 comments
Please sign in to leave a comment.