Configuring multi-site with domain mapping

We have a client that runs 15 or so e-commerce and brochureware sites for his customers. What they want to do is add a WordPress blog to each of these sites, for example:

www.site1.com/blog
www.site2.com/blog
www.site3.com/blog
www.site4.com/blog

All of these sites reside on the same server (Windows 2008R2/IIS7.5 running PHP 5.3).

Read More

Rather than have a separate install of WordPress in each /blog directory we’d like to map /blog as a virtual directory to a single install of WordPress located in a central admin site, i.e. www.clientsdomainname.com.

The idea being to enable the multi-site feature on WordPress and manage all these site’s content on one place on clientsdomainname.com.

To try and get this working with the first blog site (www.site1.com/blog) I’ve

  • Installed WordPress 3.6.1 on www.clientsdomainname.com

  • Enabled the multi-site feature

  • Mapped site1.com‘s /blog as a virtual directory pointing to the physical root of www.clientsdomainname.com on the file system (making sure permissions are correct etc).

  • Installed http://wordpress.org/plugins/wordpress-mu-domain-mapping/ and carried out the following:

  • Set my server IP address in the domain mapping configuration as per step 3 in http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/

  • Created a new site (www.clientsdomainname.com/site1) using the Network Admin bits

  • Dropped into this site’s dashboard and in Tools -> Domain mapping added: http://www.site1.com and set this as the primary domain for this site.

Now when I browse to http://www.site1.com/blog things aren’t quite right – CSS isn’t being loaded and I get WordPress’s default “This is somewhat embarrassing, isn’t it?” 404 page.

If I view the page source, site URL’s (such as for CSS) are being requested from http://www.site1.com/ rather than http://www.site1.com/blog

I’m now stuck and not sure how best to proceed with getting this to work.

Is it possible to get my desired configuration work using the multi-site feature along with one of the domain mapping plugins e.g. https://premium.wpmudev.org/project/domain-mapping/ or http://wordpress.org/plugins/wordpress-mu-domain-mapping/ ?

The following are the changes I made to the default wp-config.php file, everything else is stock:

/* That's all, stop editing! Happy blogging. */
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'clientsdomainname.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('SUNRISE', 'on');

These are the rewrite rules for the clientsdomainname.com where WordPress is installed (we use ISAPI_Rewrite3 which supports most Apache mod_rewrite directives):

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]

Related posts

1 comment

  1. I solved this without using a Domain Mapping plugin. Most of these features assume that you’re running your WordPress blog farm on the same website.

    To solve this I employed two solutions using IIS’s Application Request Routing module to reverse proxy /blog on each site to the matching WordPress site. I then rewrote the outbound links to match the public facing requesting site.

Comments are closed.