Reputation: 2460
Is there a way to redirect to a URL when a user inputs a URL in the browser that does not have an actual address but is under said domain, using the URLRewrite Module in IIS 7.5 or 8.5?
example: https://examplesite.com/test
redirected to: https://examplesite.com/site/home.aspx
<rewrite>
<rules>
<rule name="redirectURL" enabled="true" stopProcessing="true">
<match url="^.*(/test)$" />
<action type="Redirect" url="https://examplesite.com/site/home.aspx" appendQueryString="false" />
</rule>
</rules>
</rewrite>
Every entry I have tried using this module does not seem to work for this scenario.
Upvotes: 1
Views: 520
Reputation: 6050
I don't know if you can do it under IIS Rewrite rules but you can define custom error handling
<customErrors defaultRedirect="ErrorPage.aspx" mode="On">
<error statusCode="404" redirect="https://examplesite.com/site/home.aspx" />
</customErrors>
Upvotes: 2