【发布时间】:2016-01-11 14:17:48
【问题描述】:
我正在尝试重写 Mediawiki 站点中的 url,根据失败的请求日志文件输出,一切看起来都在工作。然而,正在显示的页面是原始页面,而不是重写中的 url。基本上我希望 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 显示为 Special:RunQuery 页面,但其他所有变量都显示 index.php 或 /State/City/Category。我的 web.config 重写规则如下所示:
<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天了。谢谢!
【问题讨论】:
标签: iis url-rewriting web-config iis-7.5 mediawiki