0

I have wordpress installed in a sub directory called 'blog' in the main root folder, and a web.config URL rewrite to detail with the .php extension in the root folder. I also have the standard wordpress web.config file in the 'blog' sub directory.

All works except for some reason the login page keeps refreshing itself on login which leads me to believe there is a conflict.

Would omitting the 'blog' directory in the root web.config help? I have tried but all I receive is 500 errors.

Here is the root web.config...

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect .php extension" stopProcessing="false">
  <match url="^(.*).php$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
  <add input="{URL}" pattern="(.*).php$" ignoreCase="false" />
</conditions>
  <action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
<rule name="hide .php extension" stopProcessing="true">
  <match url="^(.*)$" ignoreCase="true" />
<conditions>
  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  <add input="{REQUEST_FILENAME}.php" matchType="IsFile" />
  </conditions>
  <action type="Rewrite" url="{R:0}.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

And here is the blog/ web.config...

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
  <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
            <match url="*"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
            <action type="Rewrite" url="index.php"/>
        </rule></rules>
</rewrite>
</system.webServer>
</configuration>

Any ideas much appreciated.

elixireu
  • 255
  • 3
  • 15

1 Answers1

0

I finally found a solution to this issue and it now works a treat.

I added a new rule to omit the blog folder... <rule name="block" stopProcessing="true"> <match url="^blog/wp-login.php$" /> <action type="None" /> </rule>

This overcame the issue. This solution was found at... How to exclude a directory with IIS URL rewriting

elixireu
  • 255
  • 3
  • 15