IIS web.config 条件
IIS web.config condition
我的 Windows 服务器具有以下 web.config
设置。
问题是行:<remove fileExtension=".json" />
我如何重写它以允许 videos
目录中的 .json
个文件?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="false">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{R:1}" pattern="^(index\.php|videos)" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/index.php/{R:1}" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Detailed" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="123456789" />
</requestFiltering>
</security>
<staticContent>
<remove fileExtension=".json" /><!-- NEED CONDITION -->
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
</configuration>
从评论中复制。
IIS 配置允许通过多种方式为您的案例设置设置。可以在 this article.
中找到更多详细信息
您可以在此 web.config
文件中为 video
添加 <location>
标签,然后再添加 .json
。
或者,您可以简单地在视频文件夹中放置一个专用 web.config
来执行相同的操作。
我的 Windows 服务器具有以下 web.config
设置。
问题是行:<remove fileExtension=".json" />
我如何重写它以允许 videos
目录中的 .json
个文件?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="false">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{R:1}" pattern="^(index\.php|videos)" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/index.php/{R:1}" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Detailed" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="123456789" />
</requestFiltering>
</security>
<staticContent>
<remove fileExtension=".json" /><!-- NEED CONDITION -->
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
</configuration>
从评论中复制。
IIS 配置允许通过多种方式为您的案例设置设置。可以在 this article.
中找到更多详细信息您可以在此 web.config
文件中为 video
添加 <location>
标签,然后再添加 .json
。
或者,您可以简单地在视频文件夹中放置一个专用 web.config
来执行相同的操作。