Mobile app version of vmapp.org
Login or Join
Gretchen104

: IIS URL Rewrite Wildcards I have some URLs as follows http://localhost/wordpress/latest/joe/12 http://localhost/wordpress/latest/bloggs/14 http://localhost/wordpress/latest/thing/15 I would like to redirect

@Gretchen104

Posted in: #Iis #Iis7 #UrlRewriting

I have some URLs as follows

localhost/wordpress/latest/joe/12 http://localhost/wordpress/latest/bloggs/14 localhost/wordpress/latest/thing/15

I would like to redirect them to

localhost/wordpress/file.php?id=12 http://localhost/wordpress/file.php?id=14 localhost/wordpress/file.php?id=15

So latest needs to be in the URL, then it could be anything, then a number

Any advice? I've tried this and although the test is fine, going to the URL doesn't work. I've even tried using a rewrite map but that doesn't work either.

By 'doesn't work' I mean the original URL stays on place.

<rule name="TEST" patternSyntax="ECMAScript" stopProcessing="true">
<match url="/wordpress/latest/(.*)/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://localhost/wordpress/file.php?id=" appendQueryString="false" />
</rule>


ReWrite Map

<rule name="ArticlesRule">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{Articles:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="false" />
</rule></rules>
<rewriteMaps>
<rewriteMap name="Articles">
<add key="/wordpress/latest/dfjkdskfjdklsf/12" value="/wordpress/?id=12" />
</rewriteMap>
</rewriteMaps>

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Gretchen104

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme