• Resolved mioswebdesigns

    (@mioswebdesigns)


    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 (https://mydomain.com/) = D:\wordpress\uploads\primary\
    2.) Sub-directory site named “foo” (https://mydomain.com/foo) = D:\wordpress\uploads\foo
    3.) Sub-directory site named “bar” (https://mydomain.com/bar) = D:\wordpress\uploads\bar
    4.) Sub-directory site named “test” (https://mydomain.com/test) = D:\wordpress\uploads\test

    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 https://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 https://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:\wordpress\uploads\primary\, 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:\inetpub\wwwroot\wp-content\uploads\ 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 https://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 https://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: https://mydomain.com:80/wp-content/uploads/sites/2/test.jpg
    Physical Path: C:\inetpub\wwwroot\wp-content\uploads\sites\2\test.jpg

    If I open Windows Explorer and navigate to D:\wordpress\uploads\foo\, 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:\inetpub\wwwroot\wp-content\uploads\ 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)\PHP\v5.5\php-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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mioswebdesigns

    (@mioswebdesigns)

    Also, what is the difference between Upload Path and Upload Url Path when in Site Settings? Not sure what the difference between the two are, but the field for Upload Url Path is empty on all my sites

    screenshot

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    1.) Primary site (https://mydomain.com/) = D:\wordpress\uploads\primary\
    2.) Sub-directory site named “foo” (https://mydomain.com/foo) = D:\wordpress\uploads\foo
    3.) Sub-directory site named “bar” (https://mydomain.com/bar) = D:\wordpress\uploads\bar
    4.) Sub-directory site named “test” (https://mydomain.com/test) = D:\wordpress\uploads\test

    Why?

    WordPress already puts everything D:\wordpress\wp-content\uploads\site\#\ (so FOO has # of 2, and so on).

    Upload Url Path – URL path
    Upload Path – SERVER path

    In your case, you’d want to change the Upload Url Path path to https://mydomain.com/uploads/SITENAME

    But I have no idea if that would actually work. Never bothered to try.

    Thread Starter mioswebdesigns

    (@mioswebdesigns)

    I moved wwwroot in inetpub to D: and that fixed the issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multisite sub-directories IIS 7.5 change media/uploads location’ is closed to new replies.