Skip to content

Instantly share code, notes, and snippets.

@hendrasyp
Last active November 14, 2019 03:39
Show Gist options
  • Save hendrasyp/e1b984dd81a51c3133749989f735be6b to your computer and use it in GitHub Desktop.
Save hendrasyp/e1b984dd81a51c3133749989f735be6b to your computer and use it in GitHub Desktop.
WordPress Web.Config On IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<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>
<httpErrors>
<remove statusCode="502" subStatusCode="-1" />
<remove statusCode="501" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="412" subStatusCode="-1" />
<remove statusCode="406" subStatusCode="-1" />
<remove statusCode="405" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="400" />
<error statusCode="400" path="{vhost_path_here}\error_docs\bad_request.html" />
<remove statusCode="407" />
<error statusCode="407" path="{vhost_path_here}\error_docs\proxy_authentication_required.html" />
<remove statusCode="414" />
<error statusCode="414" path="{vhost_path_here}\error_docs\request-uri_too_long.html" />
<remove statusCode="415" />
<error statusCode="415" path="{vhost_path_here}\error_docs\unsupported_media_type.html" />
<remove statusCode="503" />
<error statusCode="503" path="{vhost_path_here}\error_docs\maintenance.html" />
<error statusCode="401" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\unauthorized.html" />
<error statusCode="403" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\forbidden.html" />
<error statusCode="404" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\not_found.html" />
<error statusCode="405" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\method_not_allowed.html" />
<error statusCode="406" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\not_acceptable.html" />
<error statusCode="412" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\precondition_failed.html" />
<error statusCode="500" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\internal_server_error.html" />
<error statusCode="501" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\not_implemented.html" />
<error statusCode="502" prefixLanguageFilePath="" path="{vhost_path_here}\error_docs\bad_gateway.html" />
</httpErrors>
</system.webServer>
</configuration>
<!-- Tambahkan dibawah section </system.webServer> -->
<location path="snippets">
<system.webServer>
<rewrite>
<rules>
<remove name="wordpress" />
<rule name="{wp_subdirectory}" 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="{wp_subdirectory}/index.php" redirectType="Found"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment