I am running WP 3.8.1 Multisite. Sub-directories is configured. I have 10 sub-directory sites and 1 primary site. WordPress is running on a Windows 2008 R2 datacenter 64bit server with IIS 7.5. I have 2 partitions on this server; 60GB drive C for OS, IIS (inetpub), and WordPress and 100GB drive D intended for all the uploads that will be going into WordPress (pictures, docs, videos, etc…)
I’m trying to point each site’s upload path to a folder on drive D, to do this I highlight My Sites > highlight Network Admin > click Sites > I pick a site and click Edit on one of the sites > and on the Edit Sites screen I click on the Settings tab and scroll down to the field “Upload Path”. I want each site to have its own folder on the D drive, for example:
1.) Primary site (http://mydomain.com/) = D:wordpressuploadsprimary
2.) Sub-directory site named “foo” (http://mydomain.com/foo) = D:wordpressuploadsfoo
3.) Sub-directory site named “bar” (http://mydomain.com/bar) = D:wordpressuploadsbar
4.) Sub-directory site named “test” (http://mydomain.com/test) = D:wordpressuploadstest
etc…
So after creating all the folders and editing each site’s upload path I did an upload test
Test #1 – Primary site
Dashboard > Media > Add New > Select File > choose file test.jpg > progress bar says “100%” then “Crunching” > I immediately notice the thumbnail for the image is broken, so I click Edit Media.
Permalink is http://mydomain.com/?attachment_id=184 and thumbnail is still broken so I click on “View Attachment Page” which takes me to a standard post page with broken image. I go back to Edit Media screen and check out the File URL which is http://mydomain.com/wp-content/uploads/test.jpg so I try to open that URL and get standard post page that says Page Not Found
If I open Windows Explorer and navigate to D:wordpressuploadsprimary, my image is there and the appropriate thumbnails that WordPress generates e.g. test.jpg (original), test-50×50.jpg, test-80×80.jpg, test-120×90.jpg, etc…
If I open Windows Explorer and navigate to C:inetpubwwwrootwp-contentuploads the folder is empty
Test # 2 – Sub-directory site “foo”
Dashboard > Media > Add New > Select File > choose file test.jpg > progress bar says “100%” then “Crunching” > I immediately notice the thumbnail for the image is broken, so I click Edit Media.
Permalink is http://mydomain.com/foo/?attachment_id=18 and thumbnail is still broken so I click on “View Attachment Page” which takes me to a standard post page with broken image. I go back to Edit Media screen and check out the File URL which is http://mydomain.com/foo/wp-content/uploads/sites/2/test.jpg so I try to open that URL and get IIS error page that reads:
Error Summary
HTTP Error 404.0 – Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Detailed Error Information
Module: IIS Web Core
Notification: MapRequestHandler
Hander: StaticFile
Error Code: 0x80070002
Requested URL: http://mydomain.com:80/wp-content/uploads/sites/2/test.jpg
Physical Path: C:inetpubwwwrootwp-contentuploadssites2test.jpg
If I open Windows Explorer and navigate to D:wordpressuploadsfoo, I see that wordpress created a folder that I did not create called “sites”, when I click on “sites” I find another folder wordpress created called “2”, I click on the folder “2” and I find that my image is there and the appropriate thumbnails that WordPress generates e.g. test.jpg (original), test-50×50.jpg, test-80×80.jpg, test-120×90.jpg, etc…
If I open Windows Explorer and navigate to C:inetpubwwwrootwp-contentuploads the folder is empty
I’m guessing it might have something to do with my rewrite rules in web.config so I’ll post that here:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<handlers>
<remove name="PHP54_via_FastCGI" />
<remove name="PHP55_via_FastCGI" />
<remove name="PHP53_via_FastCGI" />
<add name="PHP5_5_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:Program Files (x86)PHPv5.5php-cgi.exe" resourceType="Either" />
</handlers>
<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:1}" />
</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>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.html" />
<add value="index.htm" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Here are my versions:
Windows 2008 R2 datacenter 64bit
IIS 7.5
IIS Rewrite Module 2
PHP Manager 1.2 for IIS 7
MySQL Server 5.5
MySQL Connector Net 6.5.4
WordPress 3.8.1