Magento WordPress Multisite Integration Installation

« Back to Magento WordPress Multisite Integration

Before installing Magento WordPress Multisite Integration, ensure that you have the latest version of Magento WordPress Integration installed and the latest version of any FishPig add-on modules. If you do not, you should update before installing this module.

You can install the extension like any other Magento extension. For more information please see the Magento extension installation guide.

For the purposes of this tutorial, we are going to assume that you have installed WordPress in a sub-directory of Magento called 'wp'. If you have used a different directory, you can still follow along but use your directory name in place of wp.

Activate the WordPress Network

The first step is to activate the Network features in WordPress. To do this you must first disable all WordPress plugins and change your Home URL to match your SiteURL. To do this, select Settings > General and change the second URL to be the same as the first URL (both URLs should be the /wp URL). When doing this, make a note of what this URL is before changing it as we will need to change it back once we are done.

Next, open up the wp/wp-config.php file and find the following line:

/* That's all, stop editing! Happy blogging. */

Just above this, add the following:

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

To complete the activation login to the WordPress Admin and select Tools > Network Setup and then enter a title and an email address and click Install.

Once the installation has finished, you will be given 2 pieces of code. The first piece of code that is supposed to go into your wp/wp-config.php file can be ignored. Instead, open wp/wp-config.php and find the line that you added previously and right below it, add this:

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

The second piece of code will be for your new .htaccess file but may also be wrong. The correct content for wp/.htaccess file is:

RewriteEngine On
RewriteBase /wp/
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]

Logout and log back in to the WordPress Admin and the Network should now be fully activated.

Reconfigure WordPress

Now that the Network is activated, we can reconfigure WordPress so that the blog is using the correct URL. This is the URL that we changed earlier. We are now going to change it back. Unfortunately WordPress doesn't allow us to do this from the WordPress Admin. Fortunately there are 2 simple ways to do this.

The first way is to use a tool like phpMyAdmin to change the URL directly in the database. To do this, connect to the DB using phpMyAdmin and find the wp_options table. Search for the record with the key of 'home' and set the value column to the URL we changed earlier (eg. https://www.yourmagento.com/blog).

The second way is to temporarily add the following code to the very bottom of your wp/wp-config.php file.

// Change this URL for your correct integrated URL
update_option('home', 'https://www.yourmagento.com/blog');

After adding the code, refresh any WordPress Admin page and the URL will be set. You should now remove this code from wp/wp-config.php.

To check that this has worked, select Network Admin > Sites from the top navigation and then click the Edit link under your blog. When the page loads click the Settings tab and find the Home option. This should now be the correct URL.

While on the settings page, find the Permalinks structure option. If this has /blog/ hardcoded in it, you should remove it and save the changes.

WordPress should now be reconfigured and your primary blog functioning correctly. You can now add a new blog.

Magento WordPress
Multisite Integration
Documentation Articles

Post your comment

FishPig Ltd