How to create a WordPress 3.0 Multisite Network on a Windows server using sub-directories
Updated: If you’ve used this tutorial to create subdomain blogs and are having trouble logging into those blogs, here’s a fix I found that worked.
—–
I recently spent many hours — most of it Googling and staring at error pages — trying to get the new WordPress Multisite functionality working on a Windows server. I thought I would share how I finally ended up succeeding.
This tutorial is primarily for people who have control over the Windows server they are working on OR a flexible sysadmin who can make a few changes to the server should you run into problems. I’m assuming you’ve already successfully installed WordPress 3.0 and the basic functionality is working. That’s another tutorial for another time and another blogger.
STEP 1
Add this line to your wp-config.php file and save the file:
You should now see a “Network” link under Tools.
STEP 2
Temporarily disable all of your plugins. Click the Network link under Tools.
Choose “Sub-directories” for your Network type, enter a Network Title and an admin e-mail address.
If you see this error…
“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.”
… it’s because you’ve had WordPress 3.0 installed for more than 30 days. They’re trying to stop you from creating directories that may conflict with content you’ve already created. If this is not a concern for you, go ahead and install your network anyway ignoring that message. You’ll just need to edit this line after you’ve completed Step 3:
… to say …
If you’re WordPress install is relatively new with relatively little content, overriding this setting shouldn’t be a problem. If you have a lot of content already in your WordPress installation, you may want to reconsider using sub-directories. Either use sub-domains or create a fresh install of WordPress to avoid problems. If you decide to risk it anyway, make sure you backup your database in case anything goes haywire.
STEP 3
From here, follow the instructions WordPress gives you. Add the first two blocks of text to your wp-config.php file. The third bit of code probably won’t apply to you if it looks like this:
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
That’s for an .htacess file. WordPress is assuming you’re on a server running Apache, which you’re probably not. Since you’re on a Windows server, you’re probably running IIS. If your server IS running apache, then use the .htaccess file instead of the web.config file.
Add the following code to your web.config file located at the root of your site.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="WordPress Rule 2" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
</rule>
<rule name="WordPress Rule 3" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
<action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
</rule>
<rule name="WordPress Rule 4" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="WordPress Rule 5" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="WordPress Rule 6" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="WordPress Rule 7" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
If you don’t have a web.config file located at the root of your site, create one in Notepad. If you already have a web.config file setup, just add everything between the <rewrite> tags, making sure they’re nested within the <system.webServer> tags of your existing file. Save the file.
STEP 4
Go back to your Network page in WordPress and click the “Log In” link at the bottom. You’ll log in again and voila, your ability to create a Network is now available under the “Super Admin” area. This actually may just be the beginnings of your problems, but hopefully it’s the end.
If, when you tried to log in you started getting a 500 Internal Server Error, something has gone awry with your web.config file. For me, it turned out that the URL Rewrite module had not been installed on my server. You can test that by removing the <rewrite> tags and everything in between. If the site functions when that’s removed, then your server doesn’t have the URL Rewrite module. You can grab that here and install it:
http://www.iis.net/download/urlrewrite
If you don’t have the ability to install modules on your server, you’ll need to ask your sysadmin to do that for you. It’s a requirement for a sub-directory network, so you can’t skirt this issue.
STEP 5
Under Super Admin > Sites, create a new site and try to visit that site. If you’re able to see it, then you’re home free.
55 Responses to How to create a WordPress 3.0 Multisite Network on a Windows server using sub-directories
Leave a Reply Cancel reply
About me
I'm a web developer, designer, writer, communications professional, former newspaper journalist, Wordpress evangelist, news junkie, pop culture addict AND MORE! Currently employed as the Technical Communications Specialist at the Seattle Housing Authority.
My Favorite Thing Ever Right Now
Tim Tebow 80 Yard Game Winning Touchdown Pass to Demaryius Thomas - 2011-2012 AFC Wildcard (by TheNFLonDemand)
Latest from Twitter
Current Favorites from Twitter
-
matthewbaldwin Matthew BaldwinI'm lucky it's a beautiful day for a walk because my bike tire just burst and I don't have a spare and I'm 4 miles from work. So, so lucky.
-
matthewbaldwin Matthew BaldwinRoses are red / Violets are blue / Oh god I forgot you are colorblind / I am an insensitive ass
-
matthewbaldwin Matthew BaldwinI dislike this trend of people being younger than me.
-






oh wow .. I think I love you.
Hi Laura,
Thanks for the info !!
)
Your efforts are beyond appreciation
How would be the situation with the backend database ??
For example: I have this site: xyz.com
It has main navigation categories like: food, diet, nutrition, culture, health, style.
and for each of this category I would like to have a sub domain link.. such as food.xyz.com, diet.xyz.com,..etc..
Would a single default database be used for storing the posts/pages data across the main domain and all sub domains ??
If yes, then how can we create different databases for each sub domains without installing fresh version of wp on each subdomains ??
Just a thought: adding a different config file to each sub domain with different db info ?? or is there any other centralized simple way ??
Regards
Samir
Hi Samir, Multiste uses one centralized database for all the blogs, but it creates different database tables for posts/comments/etc. For example, the comment database table for your second blog would be called wp_comments2 (or similar) but it would live in the same database as wp_comments.
That’s the way multisite is configured, so if you really wanted totally different databases, you would need separate installs. The nice thing about one install is that you have one unified user database across all sites, but your content is still nicely separated by tables.
As for the web.config, I’m not sure for sub-domains because I’ve only done this with sub-directories. For sub-directories, just the one web.config file at your server’s root handles all of your blogs. I *think* it’s the same for sub-domains, but I’m not sure.
Hi Laura,
Thank you for the swift feedback and for posting this wonderful article/concept !!
Actually I would love to implement this with mutliple subdomains and having separate databases for each sub-domains.
Based upon your reply, there would 1 centralized database for all subdomains and I assume there would be 1 Index file for all sub domains ??
Any thoughts on what I need to do in case: I need to have multiple sub-domains with separate databases for each sub-domains instead of implementing fresh installation for each sub-domains !! ?
Wish you a wonderful day ahead.
Regards
Samir
Hi Laura,
Thanks for the great tutorial! I have run into an issue when following the guidelines.
I have Networks enabled, but every time I click on the URLs to open the new blogs I have created I get a 404 error.
Im guessing that this is something to do with not having the URL Rewrite Module on the server, but on further investigation, the ULR Rewrite model you have linked to is only compatible with IIS7, and I am using IIS 6.
Is there an alternative module you could recommend or any other tips to resolve the issue?
Thanks!
Michael
Samir - Sorry, I don’t know much about creating multiple databases, but I believe it’s possible. Whether or not you should do it is a different story. Curious why you want separate DB’s? Check out HyperDB to get you started: http://codex.wordpress.org/HyperDB
Michael - My condolences that you’re stuck on IIS 6. Your situation is a bit trickier and one I haven’t personally experienced. Here are a few pages to get you started. Good luck!
http://forums.iis.net/t/1169192.aspx
http://iirf.codeplex.com/
http://www.sitepoint.com/blogs/2007/08/22/making-iis-60-play-with-urlrewriting/
Hi Laura,
Thanks for the feedback.
Actually this is a good area of research and this kind of implementation would be a part of Clustered network, wherein if we setup different dbs for each subdomain (without fresh installation) then lets say if one db gets hacked or crashed then others remain safe..
Regards
Samir
Seriously, this is the best multi-post out there. Thanks for getting me out of config hell!
Hi Laura,
i don’t really post comments anywhere online but i just had to! i finally got this to work, thanks to you… much appreciated
Thanks Andy! Glad some people are finding it useful.
Thanks a lot! Your code snippet for the
is what I’ve been searching for so long…
Anyways, I’ve a question. The code snippet does make the multiple site works well with pretty permalinks, however the main site has now this ugly permalink with ”
“. Before, I used this snippet I found on internet which fixed it perfectly:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Now after using the multisite function, I replaced that code with your code snippet. When I add the “Main Rule” under “WordPress Rule 7″, it doesn’t work, the same with placing it above “WordPress Rule 1″. I don’t have much knowledge when it comes to IIS etc, do you know how to fix this?
Hi Lizzy, You had this permalink problem before activating multisite, correct? What do you have selected as your permalink setting?
That snippet you provided actually looks similar to the WordPress Rule 7 in the code snippet I posted in that they’re both trying to do something with the index.php file name. So, go ahead and try replacing WordPress Rule 7 altogether. You may also need to change “.*” to “.” in the “match url” part, but try it without doing that first.
You may also want to try slightly altering the “action type” line to look like this:
Finally, you may want to try adding this code between “system.webServer” and “rewrite” tags, like so:
<defaultDocument>
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
The source for both of those pieces of code is here and may help you:
http://www.geekblogger.org/2010/03/how-to-set-pretty-permalinks-in.html
Hopefully some combination of those changes will solve your problem! Let me know if you have any success.
Hi Laura, first, thank you for this post. Excellent information and I ALMOST have it working.
I’m having a problem with uploaded images not showing correctly. The files are located in http://mydomain.com/wp-content/blogs.dir/#/files/etc/image.jpg and the URL shown on the page is http://mydomain.com/files/etc/image.jpg... but the images are showing as broken.
Don’t know if I explained that very well. I’m using your web.config, rewrite module is “on,” permalinks and other images work, etc. It’s just the uploaded images.
Any help would be appreciated! Let me know if you need more info.
Hi Zach,
I had the same issue as you, but I’m not sure yet if my solution was a happy accident or will work for others.Take a look at my second posting on this WordPress forum thread:
http://wordpress.org/support/topic/how-to-create-a-wordpress-30-multisite-network-on-a-windows-server-using-sub-di
Let me know if those steps solve your problem as well!
Unfortunately, didn’t work for me. More fun…just realized that every image and css link is broken when I’m not using domain mapping…i.e. http://domain.com/newsite doesn’t work, but http://newsite.com works.
I’m at the end of my rope. Anyone need a few extra bucks in their pocket to fix this?
Hi Laura,
Sorry for returning back so late. The problem still isn’t resolved, here follows the problem in more detail:
Before activating multisite (there was only 1 site, I call this site X): this site has the kind of http://domain.com/index.php/hello-world permalinks.
Using a few rules I posted before worked perfectly on site X. My links from changed to http://domain.com/hello-world when I use /%postname% as the custom structure in the permalink settings.
After activating multisite, I opened a new website as a multisite (I call this site Y). For the Web.config file I replaced the original rules with your rules and everything worked fine, all the permalinks in site Y has the neat pretty links I want, just like http://domain.com/hello-world.
However, the original site (site X) now suddenly has that index.php back, like this: http://domain.com/index.php/hello-world.
I’ve tried your methods: adding rules, altering the “action type” line, change “.*” to “.” in the “match url” part… but none of them worked. Whenever I remove “index.php” in the custom structure in permalink settings, I save, then it returns back again.
I FIXED IT!!!
It’s so extremely simple!!
You don’t have to do any modification to the code you provided for the Web.config file!! Just headover to Super Admin (for multisite) and choose the website you want to change the permalinks, in my case I wanted to change the original website (site X), click EDIT, then in the list of “SITE OPTIONS” find Permalink Structure and change it here, then save.
I think it’s a bug in WordPress. Saving it through the Edit > Site Options from Super Admin works, but when saving through the dashboard > Permalink settings of the certain website doesn’t… odd!
Great Lizzy, glad you found the fix!
[...] Windows Server (IIS) Üzerinde Çoklu WordPress [...]
I have been at this for over a week and still can’t get it to work.
I have followed the instructions step by step on this site for installing to a windows server.
I have the super admin section I can click all the links and create a site but when I click the site address I get an error 404 message
I just can’t get access to the test2 site.
I put in the permalink fixes and still can’t get in.
Its driving me nuts at this point. Is there anything else I could do to get this working on my windows server. ????
Alan
PS
I’m also getting all the emails to say the site has been created and the username and password for the registered user.
Hey Alan, are you able to access the administrative pages of the site or are those pages throwing the 404 error as well? Do you know what version of IIS your Windows server is running?
When i go to the wp-admin folder I get the 404 error as well.
For example I create a site using Super Admin> Sites
/news
When I do this I get 3 emails sent to the address I used to create the new site (/news)
The Emails are:
New Site Registration
New site created by ******
New company Sites Site: Company News
I then click on the visit link under the site /news and I get the 404 FORBIDDEN page.
The IIS Version the server is running is : IIS6.0
Sorry,
I meant to say the /news/wp-admin folder
I’m assuming once I get into the /news folder I will then be able to get down deeper into wp-admin.
I can get into my domain.tld/wp-admin folder just fine.
In case you need to do that on IIS 6.0, here are the instructions:
http://www.uv.mx/personal/gvera/2010/07/07/como-crear-una-multisite-network-con-wordpress-3-0-sobre-iis-6-0/
Hope it helps
NEO -
All the information on that site is in Spanish. when I click the English like the information is gone.
Alan, sorry I can’t really say what the problem might be. If you want to share your login info and your web.config with me I can take a peek and see if I can spot the problem. I did just take a look at your site and saw that I was able to access the /news section, so you may have already figured out the issue. If so, please share for others!
Exactly what I needed!!!!
[...] Getting setup on Windows Servers This entry was posted in WordPress. Bookmark the permalink. [...]
[...] his article here [...]
I have installed WordPress 3.0.1 on IIS7 and was really really upset by not seeing the Network options. I haven’t tried your solution yet, but it’ll really change my life if your tricks works
[...] am încercat să activez Multisite cu subdirectoare folosind un articol extrem de util și detaliat How to create a WordPress 3.0 Multisite Network on a Windows server using sub-directories. A funcționat cu subdirectoare, dar în momentul în care m-am aventurat puțin și am dorit [...]
laura, is there a dramatic change to the code above when wanting to setup a wordpress network using subdomains instead of subfolders? i really want to use the subdomain model.
Hola muchas gracias por tu post, tengo una pregunta esto funciona igual asi el sitio este en una sub carpeta yo tengo http://www.misitio.com/proyectos y de esa en adelante quiero crear mi sitios ejemplo misitio.com/proyectos/1 he puesto el web.config y no consigo que me cree las carpetas en el hosting, lo raro es que el wordpress me hace todo me dice que esta listo el sitio me mandan mail peor el link queda con el error.
HTTP Error 404 – File or directory not found.
Internet Information Services (IIS)
Te agradeceria tu ayuda llevo 3 dias peliando con eso !!
Hi thank you very much for your post, I have a question that works just as well the site is in a sub folder I have a http://www.misitio.com/proyectos and that on I want to create my sites such misitio.com / projects / 1 I put the web.config and I can not I create the folders on the hosting, the strange thing is that makes me whole wordpress tells me that the site is ready send me mail link is worse with the error.
HTTP Error 404 – File or directory not found.
Internet Information Services (IIS)
We appreciate your help I have 3 days to stick it to that!
Hi,
thanks for the good explaination of implementing rules into a web.config file. I would have a question. I like to create a rule to have the word ‘category’ removed from the permalink.
On a apache server you can hack the thaccess file, like this
RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]
but how can I create this rule for the web.config file?
Any help would be apreciated.
Thanks,
Patricia
I went through this and all seemed to work but -I don’t seem to have a superadmin section. What did I do wrong?
Ignore that, it’s appeared now. Cool, great article!
Hi Laura,
Thanks!
FYI, your post is referenced on the WP Codex in “Create a Network” document. You appear to be the defacto expert for installing WP 3.0+ on Windows servers running IIS. There are lots of other trackbacks to this post from other sources.
My test install of WP 3.0.3 on my Dell Laptop running W7 and IIS 7.5 works great, except for the Akismet 2.5.1 plugin which comes bundled with WP 3.0.3.
After I depressed the “install” button to create the WP network, WP instructed me to make the same changes to the wp-config.php file and web.config files which you specified.
I deactivated all plugins before installing the network, as you advised.
After WP created the network I re-activated all plugins. However, Automattic now wants to charge me for a new API key. Here is the message I get on the Akismet plugin line on the “Plugin” page of the WP Administrator, “. . . To get started: 1) Click the “Activate” link to the left of this description, 2) Sign up for an Akismet API key, and 3) Go to your Akismet configuration page, and save your API key.”
This is not a problem for me as I plan to re-install WP on our company’s co-location facility after laptop testing.
Just thought you should know.
[...] 1. Set up a Multisite Network using subdirectories; follow the steps at http://www.lauragentry.com/wordpress/?p=517. [...]
[...] WordPress on Windows Server 2008 R2. The only helpful information I found at all about was at http://www.lauragentry.com/wordpress/?p=517. This post was almost the same as I wanted with the exception of using sub-directories versus [...]
Thank you so much for the awesome instructions!!!! For me, everything seems to be working except the admin back end. I get the login screen and try to login and nothing happens. If I request the password, as soon as it gets to wp-login.php?action=lostpassword it gets a 500 error. Thanks in advance!!
the above instruction assumes you are using IIS wenserver, in my case I’m using Apache 2. I’ve gone as far as creating a site such as http://localhost/wp/site1/; however, when I try to access the URL I get a 404 error message.
Can anyone help?
thanks
Lee
[...] as well. I found instructions for Network activation on a Windows installation of WordPress at Laura Gentry’s site. Smooth as [...]
Hi Laura – I’ve got a working single version of wordpress on IIS7.5 with W2008R2. Beatifully attached to the SQL cluster and all is good!
However, as soon as I enter
define( ‘MULTISITE’, true );
define( ‘SUBDOMAIN_INSTALL’, false );
$base = ‘/’;
define( ‘DOMAIN_CURRENT_SITE’, ‘blogs.ufv.ca’ );
define( ‘PATH_CURRENT_SITE’, ‘/’ );
define( ‘SITE_ID_CURRENT_SITE’, 1 );
define( ‘BLOG_ID_CURRENT_SITE’, 1 );
into the wp-config.php I can no longer log in! I am told that the username is wrong. I take out this code and I can log in again.
Any ideas? I’m at a loss!
Thanks in advance and thanks for such a great article!
I’ve got all working finally – except (and you knew there would be an except) I have the same issue as one of the posts above.
IIS7.5 – W08R2
I am unable to get into the /its/wp-admin folder
I can get into my domain.tld/wp-admin folder just fine.
I get the:
404 – File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Any thoughts? and thanks in advance
Hi,
The Microsoft module Rewrite won’t install on IIS6 – it needs IIS7.
Jim
I installed WordPress 3.2.1 using Microsoft Web Platform Installer. I set up a network in WordPress using these directions (very useful – thanks!). I found two issues that others might hit:
1) The XML in the web.config snippet that WordPress gives you is mal-formed XML if you just paste it straight into an empty web.config file. You need to remove all the whitespace before the XML tag on the first line otherwise you get 500 errors.
2) One of the rewrite rules is wrong. Rule 5 should have the action {R:1} rather than {R:2} so that the URl is mapped to “wp-admin” rather than “admin”. So rule 5 should look like this:
[...] http://community.godaddy.com/help/article/6495?locale=en http://lauragentry.com/blog/2010/07/30/how-to-create-a-wordpress-3-0-multisite-network-on-a-windows-... [...]
Laura,
Great tutorial. This may work for what I’m trying to do with WordPress multisite and EC2. Has anyone tried this on Amazon hosting?
Thanks
Thanks! Very helpful.
[...] And this post was helpful in configuring the network feature (though, don’t copy the web.config from here, it has a typeo, use the one from wp’s page that comes up when you enable) http://lauragentry.com/blog/2010/07/30/how-to-create-a-wordpress-3-0-multisite-network-on-a-windows-… [...]
Once, I put installed the urlrewrite module. Then the network installation steps prompted me to edit my web.config instead of the .htaccess. The key to it all was that darned urlrewrite!
Thanks so much!
I just wanted to take a moment to Thank you Laura. I’m in the process of moving a few sites from Linux to Windows. WordPress has a brilliant install for Windows, but it didn’t offer the multi-site option.
Your article made what might have been weeks of work an effortless few moments of joy. I just followed your steps, and in no time at all the job was complete.
Thank You
Joe
Hi Laura!
Great blog, and these instructions worked like a charm for installing WP Network on IIS7.
I have a question, though…
Our multisite installation is currently installed with
The first site was installed at Default Web Site in IIS (due to plugins needing this path).
The second site is then located at
If I have access to this server from another computer in my LAN, shouldn’t I be able to reach this site (or the top site) bu using URL
?
When I use this url from my computer, the web browser rewrites the url to
which, of course, doesn’t work.
Could I be missing some rewrite rules, bindings or DNS changes?