【发布时间】:2019-08-22 20:52:06
【问题描述】:
我对 .htaccess 文件有所了解,但对 web.config 文件并不了解。这里有很多关于这个的问题,我不想问一个副本,但我无法让它工作。
这就是我想要做的。
我需要转换这个网址:
https://www.website.com/some-stuff-here/replacethis/some-more-stuff-here
到这个网址:
https://www.website.com/some-stuff-here/foobar/some-more-stuff-here
我需要将 replacethis 替换为 foobar
这是我尝试过的:
<rule name="Rewrite for Foobar">
<match url="^replacethis/(.*)" />
<action type="Rewrite" url="^foobar/{R:1}" />
</rule>
<rule name="Rewrite for Foobar">
<match url="^/(.*)/replacethis/(.*)" />
<action type="Rewrite" url="^/{R:1}/foobar/{R:2}" />
</rule>
我不知道我在做什么帮助我。 :(
【问题讨论】:
-
为什么这个问题被标记为
.htaccess? -
@arkascha 你是对的。已更新。
标签: iis web-config