WordPress.org

Support

Support » How-To and Troubleshooting » How to combine WP Permalinks and non-www to www on IIS7

How to combine WP Permalinks and non-www to www on IIS7

  • Hi, I have an IIS 7 Server and I’ve configured web.config file to use Permalinks with this code:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name=”Main Rule” stopProcessing=”true”>
    <match url=”.*” />
    <conditions logicalGrouping=”MatchAll”>
    <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
    <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
    </conditions>
    <action type=”Rewrite” url=”index.php/{R:0}” />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>

    and I have another code to change non-www to www calls, this is the code:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name=”Redirect to WWW” stopProcessing=”true”>
    <match url=”.*” />
    <conditions>
    <add input=”{HTTP_HOST}” pattern=”^mydomain.com$” />
    </conditions>
    <action type=”Redirect” url=”http://www.mydomain.com/{R:0}” redirectType=”Permanent” />
    </rule>
    </system.webServer>
    </configuration>

    Separate codes are working properly but combined doesn’t work
    There is a way to combine those codes and work properly?

    Thanks in advanced

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, anyone have any idea?

    Thanks in advanced

    Hi, finally I solve this situation with this code in “web.config”…

    ———————————————–
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name=”Canonical Host Name” stopProcessing=”true”>
    <match url=”(.*)” />
    <conditions>
    <add input=”{HTTP_HOST}” negate=”true” pattern=”^mydomain\.com$” />
    <add input=”{URL}” negate=”true” pattern=”scoresubmit\.php$” />
    </conditions>
    <action type=”Redirect” url=”http://www.mydomain.com/{R:1}” redirectType=”Permanent” />
    </rule>
    <rule name=”Main Rule” stopProcessing=”true”>
    <match url=”.*” />
    <conditions logicalGrouping=”MatchAll”>
    <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
    <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
    </conditions>
    <action type=”Rewrite” url=”index.php/{R:0}” />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>
    ———————————

    I hope that is helpful for someone with the same problem…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to combine WP Permalinks and non-www to www on IIS7’ is closed to new replies.
Skip to toolbar