Created
September 28, 2014 10:20
-
-
Save misaxi/67cb1444a7dccf11f7fa to your computer and use it in GitHub Desktop.
web.config for IIS hosted multi-site WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- http://lauragentry.com/blog/2010/07/30/how-to-create-a-wordpress-3-0-multisite-network-on-a-windows-server-using-sub-directories/ --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="WordPress Rule 1" stopProcessing="true"> | |
<match url="^index\.php$" ignoreCase="false" /> | |
<action type="None" /> | |
</rule> | |
<rule name="WordPress Rule 2" 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> | |
<rule name="WordPress Rule 3" stopProcessing="true"> | |
<match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> | |
<action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> | |
</rule> | |
<rule name="WordPress Rule 4" 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" /> | |
</conditions> | |
<action type="None" /> | |
</rule> | |
<rule name="WordPress Rule 5" stopProcessing="true"> | |
<match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> | |
<action type="Rewrite" url="{R:2}" /> | |
</rule> | |
<rule name="WordPress Rule 6" stopProcessing="true"> | |
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> | |
<action type="Rewrite" url="{R:2}" /> | |
</rule> | |
<rule name="WordPress Rule 7" stopProcessing="true"> | |
<match url="." ignoreCase="false" /> | |
<action type="Rewrite" url="index.php" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
@CoastalData thanks for the fixed rule 4 worked for me ;)
Thank you very much for this. I've spent hours looking for a solution.
Still working 6 year later. Thanks.
that works in 2022! thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had to add my own Rule 7 to fix an issue with multi-site; I just copied Rule 4, which I also modified to fix errors.
<rule name="WordPress Rule 4" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(wp-(login|profile|user-edit|content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule>
<rule name="WordPress Rule 7" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(site-(new|login|profile|user-edit|content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule>