:::: MENU ::::

Domain mapping with WordPress MU, Plesk, Apache2 & Ubuntu

Given a WordPress MU install on Plesk running on Ubuntu with Apache2, we want to configure domain mapping so that

user1 can have myblog1.com mapping to their wordpress blog (myblog1.masterwpmu.com) and
user2 can have myblog2.com mapping to their wordpress blog (myblog2.masterwpmu.com)

We need to configure quite a few moving parts:

  1. DNS for masterwpmu.com – this should be an A record, pointing to the IP of your server
  2. DNS for myblog1.com & myblog2.com – these should be CNAME records, pointing to the A record in (1) – eg. masterwpmu.com
  3. Apache2 – we need to alter the apache vhost conf created by Plesk to setup a wildcard alias
  4. WordPressMU – we need to configure it to serve the right content when receiving a request for myblog2.com or myblog2.com

When someone makes a browser request for myblog2.com, the following sequence happens:

  1. myblog2.com is resolved to masterwpmu.com, which is resolved to the IP of your server.
  2. the browser makes a request to the IP, port 80, passing the host header of myblog2.com
  3. Apache intercepts the request to point 80, checks through all its known vhost server aliases, and not finding a match redirects to the wildcard alias pointing to our WPMU install
  4. WPMU gets the request, matches the host header to the correct blog content, and returns the relevant page.

So, how do we configure this?

  1. Create a new Plesk site, with its own domain name (eg. masterwpmu.com) & install WPMU.  Ensure this works.
  2. Create a new CNAME record myblog2.com which resolves to masterwpmu.com (Its also possible to setup an A record pointing to the same IP as masterwpmu.com; although this will break if the IP of masterwpmu.com ever changes).  Google has a nice set of instructions for doing this on most major DNS providers (obviously you’ll want to point to masterwpmu.com rather than ghs.google.com ;) )
  3. Edit the Apache2 vhost conf created by Plesk at: /var/www/vhosts/masterwpmu.com/conf/httpd.include, changing:
    ServerAlias *
    AllowOverride FileInfo Options
  4. restart Apache2 ( /etc/init.d/apache2 restart)
  5. Log in to the WPMU install as admin, and create a new blog.  Edit the new blog, and change the Domain & FileUpload Url to myblog2.com and http://myblog2.com/files (all the other Urls are automatically updated when you save)
  6. Browse to http://myblog2.com !


  • You can only have 1 wildcard Apache ServerAlias per IP

Hope that helps!


  • Reply fuzzydave |

    I tried what you recommended, but there is an issue.

    I don’t want to have a wildcard, so I setup the aliases under domain aliases so

    site.blog.com, site2.blog.com etc… all work now however

    i have http://www.anothersite.com setup on the server for email only, but i want to make it resolve to site2.blog.com – i’ve tried everything but I cannot get to work

  • Reply Dave |

    If you modify the httpd.include directly, plesk will end up overwriting your changes any time the virtual hosts are modified or regenerated.

    Is there a way to do this with vhost.conf ?

    • Reply Matt Auckland |

      Yes there is, here’s how you do it:-

      1. Edit or create (if you don’t have one already) the vhost.conf file for your domain, by doing the following:

      # cd /var/www/vhosts/domain.com/conf
      # vi vhost.conf

      2. Now add the code above in the post.

      3. Save changes and exit your editor.

      4. Now we must reconfigure/update the domain via Plesk to pick up the new vhost.conf changes we just made (this adds a line to the httpd.include file to look at the directives in vhost.conf we just made). To do this type the following:

      # /usr/local/psa/admin/sbin/websrvmng -a –v

      4. Finally we need to restart the apache service for the changes to take effect by typing the following:

      # /sbin/service httpd restart

      And that show do it :)

  • Reply Matt Auckland |

    Oh and also you need to close the Directory tag otherwise you’ll get an error from Apache, and it fail. Personally I’m not using the ‘AllowOverride FileInfo Options’ directory command, as I don’t believe it is strictly necessary.

    Another major break through I made tonight is, if you want wildcard https:// domains too, you need to do the same commands, but instead of a vhost.conf, create a vhost_ssl.conf.

    Works a treat on my system. Thanks for the pointers David Laing, it got me moving in the right direction.

    Best wishes, One Happy Coder (at 2:11am)

  • Reply Simon |

    I really seem to go along with pretty much everything that
    was in fact written throughout “Domain mapping with WordPress MU, Plesk, Apache2 &
    Ubuntu” bpoilspilldamages . Thanks for all the advice.
    Thanks for your time,Mari

So, what do you think ?