0

I have a WP multisite that created the following web.config files at bottom ( works perfectly ). However, how do I create 301 redirects for individual pages in the subsites?

** WP generated web.config

<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="^wp-admin$" ignoreCase="false" />
                    <action type="Redirect" url="wp-admin/" redirectType="Permanent" />
                </rule>
                <rule name="WordPress Rule 3" 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 4" stopProcessing="true">
                    <match url="^(wp-(content|admin|includes).*)" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}" />
                </rule>
                <rule name="WordPress Rule 5" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:2}" />
                </rule>
                <rule name="WordPress Rule 6" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>

    </system.webServer>
</configuration>

I want the page https://example.com/resources/a-story to go to https://example.com/mywork/a-story?

I've read this blog and it says I should be able to generate something like the snippet below it will crash the multisite:

https://www.bowlerhat.co.uk/301-redirects-for-seo-from-windows-server-iis

 <location path="/resources/a-story">
    <system.webServer>
      <httpRedirect enabled="true" destination="https://foo.com//resources/a-story" httpResponseStatus="Permanent" />
    </system.webServer>
  </location>

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.