web.config not working with WordPress permalinks in sub folder web.config not working with WordPress permalinks in sub folder wordpress wordpress

web.config not working with WordPress permalinks in sub folder


The answer as pee2pee says, is to place that line in the code.

<remove name="YourRuleName"/>

To do this you must first look at the web.config file of the root and look for this line.

<rule name = "YourRuleName" patternSyntax = "Wildcard">

and then copy the line in the web.config file of your directory or subfolder, changing "YourRuleName" to the name you found in the web.config file of the root just above the first tag.

Then, your web.config file of the sub folder should look like

<?xml version="1.0" encoding="UTF-8"?><configuration>  <system.webServer>    <rewrite>      <rules>            <remove name="YourRuleName"/>            <rule name="YourSubFolderRuleName" 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>

I hope it is helpful, for me it has been.


Ensure the root folder (serving the primary site) and the subfolder (where the secondary or /shop resides) each have a unique web.config file.

In your subfolder’s web.config file you need to remove the rule that was set in the root folder. In our case, the WordPress rewrite rule set in the root folder was called “PrimarySite”, so in the subfolder’s web.config we have:

<remove name="PrimarySite"/>

And that’s all it took to get things working. Simple, eh?