【发布时间】:2011-09-27 11:56:56
【问题描述】:
我正在尝试使用 URL 重写在我的 IIS7 服务器中创建一些重写规则。 例如,我有 url mydomain.com/data.php?id=1,我想将其转换为 mydomain.com/archive/1
目前我有:
<rule name="Ugly to friendly" stopProcessing="true">
<match url="^data\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^([^=&]+)=([^=&]+)$" />
</conditions>
<action type="Redirect" url="archive/{C:2}" appendQueryString="false" />
</rule>
<rule name="Friendly to ugly" stopProcessing="true">
<match url="archive/(.+)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="data.php?id={R:1}" />
</rule>
但它不起作用(读作“页面在没有该规则的情况下可以正常显示,但是当添加规则时不显示 css/imgs)。 奇怪,因为萤火虫告诉我一切都好(200 OK)(也许它也会混淆?)
问候
【问题讨论】:
标签: iis-7 url-rewriting