I am using URL rewrite to make user-friendly URL's. So www.mysite.som/search
is being handled by www.mysite/search.aspx
correctly. But there is one more thing I want. I want to prevent direct access to my page search.aspx
. So, if someone enters www.mysite.com/search.aspx, he should be redirected to www.mysite.com/search
instead.
What have I tried?
<rewrite>
<rule name="Redirect to friendly" stopProcessing="true">
<match url="^(.*)\.aspx$" />
<action type="Redirect" url="{R:1}" />
</rule>
</rewrite>
But its not working.