0

我想重写这个:domain.com/gallery/123123/name-of-the-image/

要从此处显示内容:domain.com/gallery/showImage/name-of-the-image-123123

这是我当前的代码:

<rule name="Gallery - Single image">
    <match url="^gallery/([0-9])/([a-z-/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
    <action type="Rewrite" url="gallery/showImage/{R:2}-{R:1}" />
</rule>

我应该如何更改重写代码以使其工作?

非常感谢提前

4

1 回答 1

0

您与 URL 匹配的正则表达式应该是:

^domain\.com\/gallery\/(\d+)\/([a-z-]+)\/?$

并且重写 URL 应该是:

domain.com/gallery/showImage/{R:2}-{R:1}
于 2013-10-16T18:29:23.880 回答