: Do a redirect in IIS, but show the original pretty url? The following case: A visitor comes in on http://www.example.com/pretty. This gets redirected to http://www.example.com/?ID=ugly. This part
The following case:
A visitor comes in on www.example.com/pretty. This gets redirected to www.example.com/?ID=ugly. This part works.
However, we'd like the visitor to keep seeing www.example.com/pretty in the address bar of his browser, instead of www.example.com/?ID=ugly.
We've tried various combinations in the URL Rewrite module, but none seem to get us the desired result.
Is this even possible?
More posts by @Alves908
1 Comments
Sorted by latest first Latest Oldest Best
This eventually did the trick.
ugly URL: domain.com/?CatID=1167 pretty URL: domain.com/people
<rewrite>
<rules>
<rule name="Redirect /people" enabled="true" stopProcessing="true">
<match url="^$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^catid=1167$" />
</conditions>
<action type="Redirect" url="/people" appendQueryString="false" />
</rule>
<rule name="Rewrite /people" enabled="true" stopProcessing="true">
<match url="^people$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="?catid=1167" />
</rule>
</rules>
<outboundRules>
<rule name="OutboundRewrite /people" preCondition="ResponseIsHtml1" stopProcessing="false">
<match filterByTags="A, Form, Img" pattern="catid=1167$" />
<action type="Rewrite" value="/people" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.