当我将目标指向root时,我无法使重写pas正常工作。
如果我指向/ page /目标,则t似乎可以正常工作,但是如果我指向/,则不能。以下是我的web.config文件中的内容
<rewrite>
<rewriteMaps>
<rewriteMap name="StaticRewrites">
<add key="/1" value="/article.aspx?id=1&title=some-title" />
<add key="/random_page.htm" value="/" />
<add key="/friends.htm" value="index.php" />
<add key="/page_2.htm" value="/index.php" />
<add key="/some_other_page.htm" value="/some_other_page/" />
<add key="/some_page_test.htm" value="/test21.php" />
<add key="/2nd_page_test.htm" value="/test.txt" />
<add key="/3rd_page_test" value="/test1.htm" />
<add key="/4th_page_test.htm" value="article.aspx?id=1&title=some-title" />
<add key="/root_page_again.htm" value="/" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Rewrite rule1 for StaticRewrites">
<match url="(.*)" />
<conditions>
<add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="WordPress: http://123.123.12.123" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
第一部作品
第2,第3,第4不起作用
第五,第六,第七,第八和第九工作了
第十名或最后一位没有
我为隐私做了一些明显的修改 IIS 8.5
答案 0 :(得分:0)
第一个有效,因为它符合第一条规则。
由于您未设置默认文档,因此第二个文档无效。它符合第一个规则,如果您设置默认文档,它将重写为http:// localhost:xx /并显示默认文档。
第3条和第4条匹配的第1条规则,都重写为http:// localhsot:xx / index.php
第5,第6,第7,第8均符合第一和第二条规则,但重写为http:// localhsot:xx / index.php //“ value”并显示index.php。
第9条匹配的第一条规则并重写为http:// localhsot:xx / article.aspx?id = 1&title = some-title。
第十名与第二名相同。
您可以打开失败请求跟踪,该请求将记录整个重写过程,包括它是否符合规则以及是否重写。
答案 1 :(得分:0)
很抱歉,我没有发布配置文件的开头。我假设每个人都会理解默认文档已设置,因为没有它,整个网站将无法加载。
这是我之前未发布的web.config的开始部分
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rewriteMap name="StaticRewrites">
在此问题上的任何帮助,我都很感谢,并且我知道我肯定会遗漏一些简单的事情,因为大多数规则实际上都可以奏效