asp.net - IIS Web.config 将一个子文件夹重定向到另一个
问题描述
我的 web.config 文件中有以下路由规则,但它不适用于以下路由:
www.domain.com/folder/new-sub/page
至
www.domain.com/folder-new/new-sub/page
如我所愿。任何人都可以帮助我更正以下规则,以便它适用于上述用例吗?
<rule name="Redirecting folder to folder-new" stopProcessing="true">
<match url="^folder/$" />
<action type="Redirect" redirectType="Permanent" url="/folder-new" />
</rule>
编辑-更具体地说...我不想硬编码新子/页面...我想要“文件夹”子目录中的任何内容到“新文件夹”子目录
解决方案
这是我修复它的方法:
<rule name="Redirecting folder to new-folder" stopProcessing="true">
<match url="^/?folder/(.*)" />
<action type="Redirect" redirectType="Permanent" url="/new-folder/{R:1}" />
</rule>
推荐阅读
- cordova - 在我的应用程序中应用了科尔多瓦通用链接插件,但是当我在浏览器上打开网站时,应用程序无法自动打开
- javascript - 时刻js中带有日期数字的工作日
- ios - com.google.GTLRErrorObjectDomain 代码=503 在 Firebase 登录目标 C
- scala - 使用 Spark Dataframe 遍历记录并根据某些条件将当前值与先前值连接起来
- sharepoint - 对动态创建的 Sharepoint 文档库使用客户端渲染(js 链接)
- node.js - 如何在带有节点 js 的 Twilio 可编程视频中使用用户自定义名称
- php - PHP 和 HTML 中的相关下拉列表
- php - 如何在functions.php中设置类的样式
- html - 在 Angular 6 模板中解析 Json 数据
- r - 如何使用 R 中的嵌套 for 循环来操作 .xlsx 数据?