WordPress.org

Ready to get started?Download WordPress

Forums

Media library not working on Multisite on IIS7 (2 posts)

  1. mfrodsham
    Member
    Posted 2 years ago #

    Hi everyone

    I hope someone can help me - I've had a look already on the forum on I've found this:

    http://wordpress.org/support/topic/media-library-links-to-page-not-found

    But that only shows ht.access rules and I have IIS and a web.config file.

    I have a multisite and basically any file I upload in the media library doesn't work when I link it - I see a preview of the photo but when I actually click it to display the image it says file not found and gives me a server error. It's obviously something to do with the rewrite rules in my web.config file. WordPress itself tells me to use this:

    <?xml version="1.0" encoding="UTF-8"?>
    <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>

    Now I had to change rule five from <action type="Rewrite" url="{R:2}" /> to <action type="Rewrite" url="{R:1}" /> to get my themes working across all the sites in the multisite, which I found here:

    http://wordpress.org/support/topic/iis-75-multisite-subdirectory-webconfig-rewrite-rules?replies=10

    I was a bit confused as to why I had to the change the code WordPress gave me to make it work! If anyone can explain that, that'd be a bonus.

    Anyway, can someone tell me how to change the rules to make the media work through the site? The site is http://www.bradshawcps.org.uk

    Thanks for your help.

  2. Josh Maxwell
    Member
    Posted 2 years ago #

    Did you ever figure out a solution to this? I'm having a similar issue.

Topic Closed

This topic has been closed to new replies.

About this Topic