Skip to content

Instantly share code, notes, and snippets.

@fulippo
Created September 18, 2014 14:20
Show Gist options
  • Save fulippo/624d08b483f7dd6fa38b to your computer and use it in GitHub Desktop.
Save fulippo/624d08b483f7dd6fa38b to your computer and use it in GitHub Desktop.
WordPress web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json"/>
<mimeMap fileExtension=".ejs" mimeType="application/javascript"/>
</staticContent>
<rewrite>
<rules>
<rule name="Imported Rule 1"><match url="^(.+)\.(.+)\.(js|css)$" ignoreCase="false"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/>
</conditions>
<action type="Rewrite" url="{R:1}.{R:3}"/>
</rule>
<rule name="Restrict wp-config.xml access" enabled="true" stopProcessing="true">
<match url=".*"/>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" pattern="wp-config.xml"/>
<add input="{HTTP_X_AdminIPAllowed}" pattern="yes" negate="true"/>
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden"/>
</rule>
<rule name="404 su risorse not found" stopProcessing="true">
<match url="\.(jpg|jpeg|png|gif|ico|swf|bmp|css|js)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="/-" />
</rule>
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment