I have a Wordpress multisite. When I add a domain mapping to example domain: "domain.com" all the images would get urls like:

http://domain.com/wp-content/uploads/sites/1/2017/02/shutterstock_400096000-Large.jpg - which is the way it should work (I guess).

however images shows up as 404, also if I go directly to the url it self. If I delete sites/1/ (in the url) the images shows up perfectly like this:


So My guessing is that there is some rewrite missing. My current IIS rewrite looks like this:

                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index\.php$" ignoreCase="false" />
                    <action type="None" />
                <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 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 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" />
                    <action type="None" />
                <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 name="WordPress Rule 6" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:2}" />
                <rule name="WordPress Rule 7" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />

Anybody knows what could be the issue? Another thing that I noticed, is that if I try to regenerate all the url's on the domain.com(example) all the images can't be found.

  • Are your current rules consistent with what Network Admin / Settings / Network Setup suggests you use?
    – Rarst
    Nov 2 '17 at 14:14
  • No. If I copy the rewrite suggestions directly from netork setup, all the sites break in the design.
    – simon
    Nov 2 '17 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.