Allowing wordpress to host multiple websites

1. download or upgrade to the latest version of wordpress.

2. In wp-config.php, add this line above the “happy blogging” comment

define('WP_ALLOW_MULTISITE', true);
/* That's all, stop editing! Happy blogging. */

3. Now login and to to admin panel via /wp-admin and go to toos -> network and follow the instructions from there. You will be asked to logout and re-login.

4. add these extra lines below the WP_ALLOW_MULTISITE code in wp-config.php. The new config looks like so:

define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'mywordpress' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
// if cannot login to wp-admin after that, insert the lines below
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
/* That's all, stop editing! Happy blogging. */

5. The .htaccess file looks like so (assuming you go for the sub-domain option):

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]

# require for wordpress multisite
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]
</IfModule>

6. Now re-login. Go to Superadmin -> sites -> add sites. Add a new subdomain, eg test.example.com

7. Now in the browser, test the subdomain. test.example.com/wp-admin should also work. Everything can now be managed from the subdomain.

8. If we want to host a full domain, ie example.com instead, go back to sites and edit test.example.com. This time, under domain, put in www.example.com instead.

Like it.? Share it:

Comments are closed.