.htaccess 到 IIS

.htaccess to IIS

<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|woff|eot|svg|ttf)$">
Header set Cache-Control "max-age=2592000, private"
Header set Expires "Sun, 17 July 2022 20:00:00 GMT"</filesMatch>

以上标记来自 laravel 应用程序的 .htaccess 文件。 即使在 laravel 应用程序 with Apache 上,这 not 对我也有效。虽然这这不是我要解决的问题。我想要实现的是在 IIS web.config 文件上重新创建相同的配置行。

有人知道吗? 以上文件似乎适用于 php artisan.

我尝试了一些在线转换器,但其中 none 接受这些行。

我收到以下错误。

标签文件匹配正常。 然后打印这个。

无法识别header集

这是我在 IIS 中用于缓存控制的方法,现在运行良好:

<configuration>
  <system.webServer>
    <staticContent>
       //choose 1 from this clientCache
       <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
            OR
       <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
    </staticContent>
  </system.webServer>
</configuration>

据我所知,IIS 不支持 .htaccess 代码。 CMIIW