I am using the iis7 URL Rewrite module to accomplish several things:
- 301 redirect rule from non-www to www
- 301 redirects the .info rule to .com (moves to the .com version of my domain)
- 301 redirects the rule from the old page, for example. / page -name.asp for page name / name
I was able to combine the first two into one rule, and the third element is my own rule. The problem is that if you request a URL, for example:
site.info/page-name.asp/
301 is executed first to:
www.site.com/page-name.asp (for example, www is added and .info goes to .com)
Then the second 301 is made from this:
www.site.com/page-name
My question is: how can I combine them so that instead of one? Here are two rules, as they are currently in my web.config:
<rule name="SEO - 301 Redirect - .info to .com AND force WWW" stopProcessing="false"> <match url="(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^site\.info$" /> </conditions> <action type="Redirect" url="{ToLower:http://www.site.com/{R:1}}" redirectType="Permanent" /> </rule> <rule name=".aspVersion-to-friendlyvia301" stopProcessing="false"> <match url="(.*).asp" /> <action type="Redirect" url="{R:1}" /> </rule>
source share