Last active
November 24, 2018 21:45
-
-
Save addisonhall/1cfaab6b28c82fa7e7adc5ee29f94f05 to your computer and use it in GitHub Desktop.
WordPress on IIS web.config with headers and cache control. Be sure to update "http://mydomain.com" with your site domain.
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
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<remove name="Vary"></remove> | |
<add name="Vary" value="Accept-Encoding"></add> | |
</customHeaders> | |
</httpProtocol> | |
<staticContent> | |
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" /> | |
</staticContent> | |
<rewrite> | |
<rules> | |
<rule name="WordPress: http://mydomain.com" 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> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<remove name="Vary"></remove> | |
<add name="Vary" value="Accept-Encoding"></add> | |
</customHeaders> | |
</httpProtocol> | |
<staticContent> | |
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" /> | |
</staticContent> | |
<rewrite> | |
<rules> | |
<!-- Begin WP Super Cache: http://www.am22tech.com/speed-up-wordpress-on-iis-windows-wp-super-cache/ --> | |
<rule name="WP super cache Windows WordPress" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions logicalGrouping="MatchAll"> | |
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /> | |
<add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> | |
<add input="{QUERY_STRING}" pattern=".*attachment_id=.*" negate="true" /> | |
<add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress|wp-postpass_).*$" negate="true" /> | |
<add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{HTTP_HOST}/{R:1}index.html" matchType="IsFile" /> | |
</conditions> | |
<action type="Rewrite" url="wp-content/cache/supercache/{HTTP_HOST}/{R:1}index.html" /> | |
</rule> | |
<!-- End WP Super Cache --> | |
<rule name="WordPress: http://mydomain.com" 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