I am having an issue using IIS URl redirect module. Trying to redirect from www.site.com/directory1/default.aspx to www.site.com/directory2/default.aspx
So any request to directory1 needs to go to directory 2. I am going to be disabling the application at directory 1 Any ideas? Currently i have the below, but does not work.
<rewrite>
<rules>
<remove name="Portal Test Redirect" />
<rule name="Portal Test Redirect" patternSyntax="Wildcard">
<match url="*directory1/*" ignoreCase="false" />
<conditions />
<serverVariables />
<action type="Rewrite" url="{R:1}/directory2/{R:2}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
You need to change your rule as below
<rewrite>
<rules>
<rule name="Portal Test Redirect">
<match url="(.*)(directory1)(.*)" patternSyntax="ECMAScript"/>
<action type="Rewrite" url="{R:1}directory2{R:3}" />
</rule>
</rules>
</rewrite>
1.Open web.config in the directory where the old pages reside 2.Then add code for the old location path and new destination as follows:
<configuration> <location path="services.htm"> <system.webServer> <httpRedirect enabled="true" destination="http://domain.com/services" httpResponseStatus="Permanent" /> </system.webServer> </location> <location path="products.htm"> <system.webServer> <httpRedirect enabled="true" destination="http://domain.com/products" httpResponseStatus="Permanent" /> </system.webServer> </location> </configuration>
Try above. Refered from Setting up redirect in web.config file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.