WordPress Multisite using Sub-directory instead of Sub-domain

When you install wordpress multisite on an existing blog, you might encounter this message:

Because your install is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.

Won’t be a problem if you are okay with using subdomains upon adding a new site. However, if you prefer to use sub-directory, here’s a workaround:

During Network Setup, it will ask you to add some lines to your htaccess and your wp-config.php. On your wp-config.php (the one you just edited), you will find this line:

define( 'SUBDOMAIN_INSTALL', true );

Change it to:

define( 'SUBDOMAIN_INSTALL', false );

you can now add site using subdirectories. Again, HOWEVER, you might have a problem loading your sites. So, here’s the final thing to solve the problem:

Replace your htaccess with the following codes:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ [L]
# uploaded files
RewriteRule ^([_09azAZ]+/)?files/(.+) wpincludes/msfiles.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_09azAZ]+/)?wpadmin$ $1wpadmin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} f [OR]
RewriteRule ^ [L]
RewriteRule  ^[_09azAZ]+/(wp(content|admin|includes).*) $1 [L]
RewriteRule  ^[_09azAZ]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress
That’s all!



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s