Install a Network under a mapped domain

I’m already running a WordPress installation just fine under a mapped domain.
The current setup points (www).sample.com to /sample/ within domain.com, and it works fine. In the Create A Network section of the WP Codex, it states “Domain mapping, however, will not work” but I would like to know if it is possible to make this installation into a network by manually editing the .htaccess file or some configuration somewhere. I feel like this should be possible, I can’t see a reason why it couldn’t be done, it’s just complicated. Any input would be greatly appreciated.

Related posts

Leave a Reply

2 comments

  1. This is possible, and it actually should be very easy for you to do.

    There are lots of ways that you could have this setup, depending on if your server is using cPanel, Plesk, etc. At its most basic, right now, your Apache virtual host points to your main web directory, maybe something like /var/www/, and you have your htaccess file routing the domain to a subdirectory of that. What you need to do is change your virtual host to point to the directory in which WordPress actually resides instead of its parent directory. You’ll want it to look something like this:

    <VirtualHost *:80>
        ServerAdmin your@email.com
        DocumentRoot "/var/www/sample"
        ServerName sample.com
        ServerAlias *.sample.com
    </VirtualHost>
    

    How you do that will depend on your server’s software if applicable. If you don’t feel comfortable making changes to your server config, you should consult your web host and I’m sure they’d be happy to make this edit for you.

    Cheers~

  2. The first site in multisite installation will have /blog pre-pended to all permalinks. So its a bad idea to convert your existing site to a multisite installation. I suggest creating a new multisite install with domain mapping enabled. Then add a site to your network. When you do that it will create a bunch of tables like these:

    wp_2_commentmeta |
    | wp_2_comments |
    | wp_2_contact_form_7 |
    | wp_2_links |
    | wp_2_options |
    | wp_2_postmeta |
    | wp_2_posts |
    | wp_2_term_relationships |
    | wp_2_term_taxonomy |
    | wp_2_terms

    You want to replace these tables with the ones in your current blog. That would be a rename table operation in phpmyadmin. Rename and move the tables over to the multisite database.

    Finally move wp-contents/uploads and any plugins and themes from your current blog to your multi-site install.

    BTW you can have multi-site on a shared hosting account. Just make sure the document root of any multi-site domains is set to the multi-site wp installation directory.