web.config 将文件夹名重定向到文件名
web.config redirecting folder name to file name
我在 windows 服务器上托管了我的网站。当用户浏览站点名称时,我试图将用户重定向到 Web 服务器内的 .html 文件。com/foldername/
我应该在 web.config 文件中添加或修改什么标签才能实现此目的。我在 linux 托管服务器上工作时使用了 .htaccess 文件。
首先你必须为 iis 安装 url 重写扩展,然后在你的 webconfig 文件中使用这个配置:
<system.webServer>
<rewrite>
<rules>
<rule name="redirecting to html file" stopProcessing="true">
<match url="sitename.com/foldername/" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="your html file address" />
</rule>
</rules>
</rewrite>
我在 windows 服务器上托管了我的网站。当用户浏览站点名称时,我试图将用户重定向到 Web 服务器内的 .html 文件。com/foldername/
我应该在 web.config 文件中添加或修改什么标签才能实现此目的。我在 linux 托管服务器上工作时使用了 .htaccess 文件。
首先你必须为 iis 安装 url 重写扩展,然后在你的 webconfig 文件中使用这个配置:
<system.webServer>
<rewrite>
<rules>
<rule name="redirecting to html file" stopProcessing="true">
<match url="sitename.com/foldername/" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="your html file address" />
</rule>
</rules>
</rewrite>