url-rewriting - URL 从尾随字符串重写为 GET 变量
问题描述
我已经搜索过这个,但似乎无法找到正确的搜索词 - 似乎这将是一个常见问题。
WIMP,IIS版本为8
我想提出一个重写规则:传入 URL: http ://example.com/1a2b3cdef 重写为:http ://example.com?p=1a2b3cdef
请注意,此 URL 的开头将始终是“http://example.com/”(不是真正的域名),永远不会改变。
从那里我的 index.php 的默认文档将检索 GET 变量 p。任何帮助是极大的赞赏。
解决方案
这是可以在 web.config 中应用的配置。
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="rewrite" enabled="true">
<match url="^[_0-9a-z]+" />
<action type="Rewrite" url="?p={R:0}" />
</rule>
</rules>
</rewrite>
推荐阅读
- angular - 将 CSS 类应用于组件标签
- python - Keras/Tensorflow中dropout的动态切换
- powershell - 如何调用 Jenkins API 并使用 powershell 发送自定义参数
- sql - 行聚合的案例语句
- javascript - 如何导入 Typescript 所需的 chrono 库?
- java - 当你在 mockito 框架中模拟一个类时,你会手动建立实际的模拟类吗?
- svg - SVG过滤器将alpha值映射到表格中的RGB值?
- airflow - Apache Airflow 1.10+ 调度程序是否支持在特定时间在不同的 DST 感知时区运行 2 个 DAG?
- python - 在 python 中设置服务器并获得线程异常,我该如何解决这个问题?
- bash - 为什么我在从 yes 读取的循环中丢失字节?