Pete McPhearson
Pete McPhearson

Reputation: 469

Configure IIS7 HTTP redirect at a site level

When configuring IIS 7 HTTP redirect it appears that there is an option to set this at the server level and also an option to set this for individual sites.

However, when using IIS Manager, if I alter the settings for one site it overwrites the settings for other sites.

for example: if I set up:

gubbin.com >> www.gubbin.com

that works fine

if I then go into monkey.com and add a redirection

monkey.com >> www.monkey.com

when I go back to gubbin.com I find it has been overwritten:

gubbin.com >> www.monkey.com

Is this a limitation of IIS (i.e. can only handle one redirect at a time) or a bug in the Manager application?

Can I get the desired results by editing a config someplace - or do I need to get a URL re-writer or something?

Upvotes: 3

Views: 2671

Answers (1)

Pete McPhearson
Pete McPhearson

Reputation: 469

D'oh.

The IIS Manager is just editing the web.config for the site - and hence putting a redirect section into the config:

<configuration>
   <system.webServer>
      <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
         <add wildcard="*.php" destination="/default.htm" />
      </httpRedirect>
   </system.webServer>
</configuration>

The issue I had was that I set up the redirect sites to point that the same folder (since there's no content it didn't seem worth having a whole folder structure for each one)

The solution is to have a folder for each site, just to store the web.config for the redirect.

Upvotes: 3

Related Questions