Question

I wish to redirect ALL pages from a specific folder and its subfolders to a page on root folder. I have written the following rule in IIS 7.5 but it is not working. Please advise.

<rule name="someName" stopProcessing="true">
<match url="/MoveFromThisFolder/.*" />
<action type="Rewrite" url="/ToThisFile.html" appendQueryString="false" />
</rule>
Was it helpful?

Solution

I modified the rule as follows and it worked for me!

<rule name="SomeRule" stopProcessing="true">
<match url="^FromThisFolder/(.*)" />
<action type="Redirect" url="ToThisFile.html" appendQueryString="false" />
</rule>

OTHER TIPS

Try getting rid of the leading "/"

<rule name="someName" stopProcessing="true">
<match url="^MoveFromThisFolder/($|[\?/].*)" />
<action type="Rewrite" url="ToThisFile.html" appendQueryString="false" />
</rule>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top