WordPress network with any domains and paths, no plugins required

Goal: host several blogs from a single WordPress installation. Each blog should be reachable from a any domain and directory. For example:

  • http://example1.com/blog
  • http://example1.fr/blog
  • http://example2.com/something-else
  • http://example3.com

… etc.

It turned out to be possible without 3rd party plugins. You’d only have to edit the database.

Please note that: 1) this is a recipe for people who know what they’re doing. (However, if you don’t understand something, you may ask in the comments). 2) DNS and server configuration is beyond the scope of the article.

Step 1. Install WordPress, create a network, then create a second blog in the network. Set domain/path to anything.

Step 2. Open a database manager (e.g. phpMyAdmin, Sequel Pro…), find the table called wp_2_options and adjust siteurlhomefileupload_url, so they contain the desired domain of your second blog (in my example: example1.fr).

Step 3. Find the table called wp_site. It should contain one entry. Add a new entry for the second blog.

Step 4. Find the table called wp_blogs. For the existing entry where blog_id equals 2, change site_id to 2, for example:

Step 5. Make sure that in your wp_config.php constant SUBDOMAIN_INSTALL is set to true.

So this is good:

define( 'SUBDOMAIN_INSTALL', true );

Note that from now on you’d have to authorize separately in each of your sites’ admin areas, although all user accounts will be shared.

This entry was posted in How to’s and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *