URL Redirect Loop from domain.com to www.domain.com—multisite/subdirectory IIS7 (1 post)

  1. Sapphireblue
    Posted 1 year ago #

    All our blogs are of URL pattern http://www.mydomain.com/blogs/myblogname . If someone requests one of these blogs with a URL pattern that omits the http://www., it results in a too many redirects browser error. Our "home" url in wp_options does indeed specify the www.

    Our complete web.config file is pasted below. Note that the first rule, the "Add WWW prefix," does absolutely nothing as far as I can tell.

    This isn't a web.config I wrote, I'm not really a WP programmer, and I've had a devil of a time trying to search the web for what would be a good web.config for my particular setup, so I feel like I'm just flailing blindly. For like a week. I would be enormously grateful for troubleshooting help. Thank you.

    <?xml version="1.0" encoding="UTF-8"?>
            <rule name="Add WWW prefix" enabled="true" stopProcessing="true">
              <match url="(.*)" ignoreCase="true" />
                <add input="{HTTP_HOST}" pattern="^mydomain\.com" />
              <action type="Redirect" url="http://www.mydomain.com/blogs/{R:1}" />
            <rule name="WordPress Rule 1" enabled="true" stopProcessing="true">
              <match url="^index\.php$" ignoreCase="false" />
              <action type="None" />
            <rule name="WordPress Rule 2" enabled="true" 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" enabled="true" 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" enabled="true" 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" enabled="true" 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" enabled="true" stopProcessing="true">
              <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
              <action type="Rewrite" url="{R:2}" />
            <rule name="WordPress Rule 7" enabled="true" stopProcessing="true">
              <match url="." ignoreCase="false" />
              <action type="Rewrite" url="index.php" />

    Other misc data points:

    I, just, agh, help.

Topic Closed

This topic has been closed to new replies.

About this Topic