Creating subdomain installation instead of subdirectory for multisite.

Hi,

I created my multisite installation with Softocolous. However when I create a subdomain, it creates subdirectory as mysite.com/example instead of subdomain as example.mysite.com. What manual changes shall I do to change the multisite site creation from subdirectory to subdomain.

Thanks

  • Vaughan

    Hi @me55,

    Welcome to wpmudev.

    As you have only just created it, it might be easier than doing it with an already established site.

    First you should completely delete the sub site you already created (if it doesn't have anything on it yet) as it will make it easier.

    Then you need to edit your wp-config.php & your htaccess.

    Change the multisite defines so they look like:

    * Multisite */
    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'yourdomain.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    Then change your htaccess so it looks like

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress

    You then need to setup a wildcard subdomain in your servers cpanel

    Go to subdomains and create a wildcard subdomain for your domain so it looks like:

    *.yourdomain.com

    Make sure it points at your sites documentRoot (The folder where wp-config.php resides)

    Hopefully that should sort it, though i've never done it with a softaculous install before)

    Always Backup before making any changes.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.