Anton
Anton

Reputation: 63

iis7 redirect from exact url to new site

I want to re-direct from an exact URL request to a new site within that domain.

I need to re-direct requests from

 www.example.com/site111/default.aspx?configX.xml 

(this site uses a different config file to load content)

to

 www.example.com/site222/default.aspx

Issue is that I need to leave access www.example.com.au/site111/default.aspx so I cannot just to a http re-direct as there is no file called default.aspx?configX.xml

I think I need to use a URL rewrite re-direct Can someone help me with the syntax for the web config I cannot get it to work


0 module installed and have used the above syntax and it still doesn't work,

If I use the test feature on the module it says that the string matches, very confused, the actual webconfig section is here

<rewrite>
  <rules>
    <rule name="Redirect2" stopProcessing="true">
       <match url="\/nrmmaps\/default.aspx\?config=nrmproject.xml$" />
       <action type="Redirect" url="/nrmproject/default.aspx" redirectType="Permanent"/>
    </rule>
  </rules>
 </rewrite>  

and the old link is

http://se.nrmspace.com.au/nrmmaps/default.aspx?config=nrmproject.xml

and I want it to re-direct to

http://se.nrmspace.com.au/nrmproject/default.aspx

Do you have any idea why this is not working?

Upvotes: 2

Views: 2028

Answers (1)

MatthewJ
MatthewJ

Reputation: 3187

I believe you need to install the IIS rewrite module which can be found here: http://www.iis.net/downloads/microsoft/url-rewrite

After you do that, you can add a rewrite section with a redirect rule in your web.config like so:

 <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect" stopProcessing="true">
           <match url="\/site111\/default.aspx\?configX.xml$" />
           <action type="Redirect" url="/site222/default.aspx" redirectType="Permanent"/>
        </rule>
      </rules>
     </rewrite>
  </system.webServer>

Hope this helps

Upvotes: 1

Related Questions