Iis 7 IIS7和rewriteMap用于友好URL';s

Iis 7 IIS7和rewriteMap用于友好URL';s,iis-7,web-config,rewrite,rewritemap,Iis 7,Web Config,Rewrite,Rewritemap,我有一个外部“rewritemaps.config”文件,其中包含以下条目: <rewriteMaps> <rewriteMap name="Cat1"> <add value="2" key="wheels-and-castors" /> <add value="3" key="agricultural" /> <add value="4" key="hydraulic-hose

我有一个外部“rewritemaps.config”文件,其中包含以下条目:

<rewriteMaps>  

    <rewriteMap name="Cat1">
        <add value="2" key="wheels-and-castors" />
        <add value="3" key="agricultural" />
        <add value="4" key="hydraulic-hose-and-fittings" />
        <add value="5" key="engineering-plastics" />
        <add value="6" key="sealing-and-jointing" />
        <add value="7" key="health-and-safety" />
        <add value="8" key="hose-and-ducting" />
        <add value="9" key="hose-couplings-and-clamps" />
        <add value="10" key="general-consumables" />
        <add value="11" key="ceramics" />
        <add value="12" key="rubber-and-polyurethane" />
    </rewriteMap>

</rewriteMaps>

对下列事项:

注意,这是一个重写,而不是重定向

我想我几乎完成了最后的改写,但我在比赛和比赛条件上都很挣扎。我当前的最终重写行是:

<action type="Rewrite" url="category.asp?catID={Cat1:{C:1}}" appendQueryString="false" />

(其中Cat1是我的地图的名称)


谢谢你的帮助。干杯,克里斯。

好的,经过一周的研究和尝试,我已经开始工作了。下面是我使用的完整规则,它引用了一个外部“rewritemaps.config”


现在效果很好


另外,我将rewriteMap重命名为“CatMap”(以避免任何人在遵循此操作时感到困惑)。

好的,经过一周的研究和尝试,我已经让它工作了。下面是我使用的完整规则,它引用了一个外部“rewritemaps.config”


现在效果很好

另外,我将rewriteMap重命名为“CatMap”(以避免任何人在遵循此命令时感到困惑)

<rule name="Match Category URLs" stopProcessing="true">
    <match url="^(?![^/]+?\.(?:css|png|jpg|axd)$)([^/]+)/?$" />
    <conditions>
        <add input="{URL}" pattern="(.asp|.xml)" negate="true" />
    </conditions>
    <action type="Rewrite" url="category.asp?catID={CatMap:{R:1}}" appendQueryString="false" />
</rule>