Reputation: 47
I am using the IIS Rewrite module with my web.config, and would like to rewrite certain requests by replacing a word in the URL. Example: http://domain.com/windows to be http://domain.com/WINDOWSSoftware
I'm aware that a URL with query string parameters can be rewritten using for example below rule
<rules>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&title={R:2}" />
</rule>
</rules>
Instead of /article?id=243&title=some-title we can have /article/234/some-title
I'm wondering if this can be achieved using URL Rewrite, or can it be done by developing a custom provider.
Upvotes: 2
Views: 4464
Reputation: 189
This can definitely done with url rewrite module with bit of regex pattern matching. http://domain.com/windows/sdfsdf
so if you just match {R:1} or {C:1} depending on how you setup
The final redirect can look like {HTTP-HOST}/WindowsSoftware/{R:2}
Upvotes: 2