I’ve got three installations of WordPress on the same server, and they’re with the following layout:
Site1
Site1Site2
Site1Site3
I have four URLS www.site1.com, www.site2.co.uk, www.site2.com and www.site3.co.uk. I’d like to set up URL rewriting in a web.config file so that the URLs point to their corresponding folders. Also I need the WordPress installations to use Permalinks.
This is my set up (completely not working) at the moment:
<rule name="site1" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="index.php"/>
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site2.co*" ignoreCase="true" negate="true"/>
<add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site3.co*" ignoreCase="true" negate="true"/>
<add input="{PATH_INFO}" pattern="*site2*" negate="true"/>
<add input="{PATH_INFO}" pattern="*site3*" negate="true"/>
</conditions>
</rule>v
<rule name="site2" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site2/index.php"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site2.co*" ignoreCase="true" negate="false"/>
<add input="{PATH_INFO}" pattern="*site2*" ignoreCase="true" negate="false"/>
<add input="{PATH_INFO}" pattern="*wp-admin*" negate="true"/>
<add input="{PATH_INFO}" pattern="*wp-content*" negate="true"/>
<add input="{PATH_INFO}" pattern="*wp-login*" negate="true"/>
</conditions>
</rule>
<rule name="site2-content" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site2/{R:0}"/>
<conditions>
<add input="{HTTP_HOST}" pattern="*www.site2.co*"/>
<add input="{PATH_INFO}" pattern="*wp-content*"/>
</conditions>
</rule>
<rule name="site2-admin" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site2/{R:0}"/>
<conditions>
<add input="{HTTP_HOST}" pattern="*www.site2.co*"/>
<add input="{PATH_INFO}" pattern="*wp-admin*"/>
</conditions>
</rule>
<rule name="site2-login" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site2/{R:0}"/>
<conditions>
<add input="{HTTP_HOST}" pattern="*www.site2.co*"/>
<add input="{PATH_INFO}" pattern="*wp-login*"/>
</conditions>
</rule>
<rule name="site3" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site3/index.php"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site3.co*" ignoreCase="true" negate="false"/>
<add input="{PATH_INFO}" pattern="*site3*" ignoreCase="true" negate="false"/>
<add input="{PATH_INFO}" pattern="*wp-admin*" negate="true"/>
<add input="{PATH_INFO}" pattern="*wp-content*" negate="true"/>
<add input="{PATH_INFO}" pattern="*wp-login*" negate="true"/>
</conditions>
</rule>
<rule name="site3-content" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site3/{R:0}"/>
<conditions>
<add input="{HTTP_HOST}" pattern="*www.site3.co*"/>
<add input="{PATH_INFO}" pattern="*wp-content*"/>
</conditions>
</rule>
<rule name="site3-admin" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site3/{R:0}"/>
<conditions>
<add input="{HTTP_HOST}" pattern="*www.site3.co*"/>
<add input="{PATH_INFO}" pattern="*wp-admin*"/>
</conditions>
</rule>
<rule name="site3-login" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewrite" url="site3/{R:0}"/>
<conditions>
<add input="{HTTP_HOST}" pattern="*www.site3.co*"/>
<add input="{PATH_INFO}" pattern="*wp-login*"/>
</conditions>
</rule>
<rule name="wordpress" patternSyntax="Wildcard" stopProcessing="true">
<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>
Any help much appreciated.