我想重写一个Mediawiki网站中的网址,并且一切看起来正在根据失败的请求日志文件输出工作。然而,正在显示的页面是原始页面,而不是重写中的网址。基本上,我想
www.website.com/State/City/Category
在
www.website.com/index.php?title=Special:RunQuery/CategoryPage&CategoryPage[State]= State&CategoryPage[City]=City&CategoryPage[Category]=Category&wpRunQuery=true
而似乎是展示在
www.website.com/index.php?title=State/City/Category
印刷_SERVER页面显示的页面显示QUERY_STRING作为特别:RunQuery页,但在其他方面所有其他变量显示index.php或/ State/City/Category。我的web.config重写规则看起来像这样:Web配置重写规则不显示正确的页面
<rewrite>
<rules>
<rule name="Root Hit Redirect" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="/index.php?title=Main_Page" />
</rule>
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^index\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" />
<add input="{QUERY_STRING}" pattern="^title=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyCategoryURL" stopProcessing="true">
<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?title=Special:RunQuery/CategoryPage&CategoryPage[State]={UrlDecode:{R:1}}&CategoryPage[City]={UrlDecode:{R:2}}&CategoryPage[Category]={UrlDecode:{R:3}}&wpRunQuery=true" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<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?title={UrlDecode:{R:1}}" />
</rule>
</rules>
</rewrite>
感谢任何帮助,以弄清楚这一个。现在我已经打了2天脑子。谢谢!
赞赏您检查出来。我尝试了失败的请求追踪,就像我上面所说的,一切似乎都没问题。在日志结尾处,它执行了一个看起来不错的重写操作,规则评估显示了新的查询字符串,重写结束显示了index.php的请求url,然后它向完整正确的字符串发出请求,然后以200成功。我想知道的是,也许Mediawiki正在寻找其他的东西,并根据其他变量提供不同的页面。 Request_URI仍然设置为/ State/City/Category。你可以改变web.config中的Request_URI和其他_Server变量吗? –