Score:1

IIS Rewrite module, simple rule

uy flag

I am stuck on a very simple IIS rewrite rule. I have a series of links that have an invalid path, and I need to redirect all requests to that path to a new one.

Here is the broken path: https://documentation.buzsoftware.com/buzdocs/BuzClubManager/index.cfm?ID=690

The "buzdocs" portion of the path no longer exists and all links below this path have been moved up one folder to this example path (which works): https://documentation.buzsoftware.com/BuzClubManager/index.cfm?ID=690

<rule name="buzdocs_path_del" stopProcessing="true">
    <match url="(.*)/buzdocs(.*)" />
    <action type="Rewrite" url="{R:1}{R:2}" appendQueryString="false" />
</rule>

or

<rule name="buzdocs_path_del" stopProcessing="true">
    <match url="https://documentation.buzsoftware.com/buzdocs(.*)" />
    <action type="Rewrite" url="https://documentation.buzsoftware.com/{R:1}" appendQueryString="false" />
</rule>

I have been trying a wide variety of regex patterns, and every time I go to the incorrect path I get a 404, and I am not redirected.

I'm not sure if I need to use the ^ (start of line) or $ (end of line) in the pattern match, I've tried both with the same result.

Using only the {R:1} (first example) vs. using both {R:1} and {R:2} (second example), not sure which is the right way. Any comments on best practices would be helpful.

I've also bounced back and forth between <action type="Rewrite" and <action type="Redirect", with no change.

These links are to a live site, feel free to hit them. Thanks for any advise, I'm pretty sure I'm missing something small, and I will probably hit my head on my desk for it.

Lex Li avatar
vn flag
https://blog.lextudio.com/the-very-common-mistakes-when-using-iis-url-rewrite-module-a2ab7e4fee59 Mistake 1.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.