Replace a word using IIS URL Rewrite

Moe

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}&amp;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.

zman

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}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related