I installed a URL Rewrite Module 2 in my iis and i have this rule
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ASPX to ASP Redirect" stopProcessing="true">
<match url="([_0-9a-z-\.]+).com/([_0-9a-z-]+).aspx$" />
<action type="Redirect" url="http://{R:1}.com/{R:2}.asp" appendQueryString="true" logRewrittenUrl="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Basically what i wanted was to create match things like http://www.test.com/default.aspx and redirect it to an it’s asp version so when i type http://www.test.com/default.aspx it will redirect to http://www.test.com/default.asp.
Not sure what’s wrong with this.
The domain name is not part of the URL that is matched against your regular expression. Does it really matter what the domain name is? I would say, as long as the URL ends with
.aspxit should redirect to the same page ending in.asp. That is very easy to do: