简体   繁体   中英

Converting htaccess to web.config

I'm trying to convert this htaccess file into webconfig so I can setup my wordpress W3 Total Cache. As it keeps giving me an error when I active the minify that it cannot read the rewrite rules of the cache folder.

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css M31536000
    ExpiresByType application/x-javascript M31536000
</IfModule>
<IfModule mod_mime.c>
    AddEncoding gzip .gzip
    <Files *.css.gzip>
        ForceType text/css
    </Files>
    <Files *.js.gzip>
        ForceType application/x-javascript
    </Files>
</IfModule>
<IfModule mod_deflate.c>
    <IfModule mod_setenvif.c>
        SetEnvIfNoCase Request_URI \.gzip$ no-gzip
    </IfModule>
</IfModule>
<IfModule mod_headers.c>
    Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    Header set Vary "Accept-Encoding"
</IfModule>
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wp-content/w3tc/min/
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=APPEND_EXT:.gzip]
    RewriteCond %{REQUEST_FILENAME}%{ENV:APPEND_EXT} -f
    RewriteRule (.*) $1%{ENV:APPEND_EXT} [QSA,L]
    RewriteRule ^([a-f0-9]+)\/(.+)\.(include(\-(footer|body))?(-nb)?)\.[0-9]+\.(css|js)$ index.php?tt=$1&gg=$2&g=$3&t=$7 [QSA,L]
</IfModule>

Has anyone been able to successfully setup the W3 Total Cache using IIS?

You can also do like this its working W3C may not required.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <caching enabled="true" enableKernelCache="true" maxCacheSize="1000" maxResponseSize="512000"/>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^index.php$" ignoreCase="false" />
          <action type="None" /></rule>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="." ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
            <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="index.php" /></rule>
      </rules>
    </rewrite>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="3.00:00:00" />
    </staticContent>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"><scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
    </httpCompression>
  </system.webServer>
</configuration>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM