1

I have the following httpredirect in the web.config which is being ignored. This web.config is on the root of a hybrid webforms and MVC web application. Both locations in the example below are webforms pages.

<configuration>
<system.webServer>
    <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent">
      <add wildcard="*/foldername/" destination="/anotherfolder/file.aspx" />
    </httpRedirect>
  </system.webServer>
</configuration>

This is on localhost btw but the httpredirect should work on both the localhost and the live server. What am I doing wrong?

NOTE: There are a lot of instructions on the web pointing to the URL Rewrite IIS module. I can't install this on the live server so that's not an option.

Organic
  • 247
  • 1
  • 21
  • https://www.iis.net/configreference/system.webserver/httpredirect Have you followed the setup instructions ? – JamesKn Jun 16 '16 at 10:36
  • I thought such a basic feature would be installed by default! On my test machine ie localhost I only have IIS 7.5 installed, I can't seem to find Server Manager as specified in link. – Organic Jun 16 '16 at 13:42
  • I'm running Windows 7 btw. – Organic Jun 16 '16 at 14:00
  • Did you look at the WINDOWS VISTA OR WINDOWS 7 section further down the page should sort you out. – JamesKn Jun 17 '16 at 11:35
  • Yeah, I had to install the module for Windows 7. Don't know how I totally overlooked that section when I scanned the instructions and it didn't even occur to me that the process of module installation might be different in Windows 7 to that of Windows Server. Doh! – Organic Jun 17 '16 at 11:54
  • Good to hear ;) honestly it also happens to the best of us ;) – JamesKn Jun 17 '16 at 11:58
  • 2
    Possible duplicate of [How to redirect a site to another location in IIS7](http://stackoverflow.com/questions/9430295/how-to-redirect-a-site-to-another-location-in-iis7) – CodeCaster Jun 17 '16 at 12:06

1 Answers1

2

https://www.iis.net/configreference/system.webserver/httpredirect

For anyone in the future. Check Modules are installed from above link.

JamesKn
  • 1,035
  • 9
  • 16
  • And notice that there's no such thing as Server Manager in Windows 7 but you can still install modules through Control Panel > Programs And Features > Turn Windows Features on or off – Organic Jun 17 '16 at 12:05
  • [Are answers that just contain links elsewhere really “good answers”?](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers). Also, [this question has been asked and answered before](http://stackoverflow.com/questions/9430295/how-to-redirect-a-site-to-another-location-in-iis7), so please just flag to close as duplicate. – CodeCaster Jun 17 '16 at 12:07
  • In my case, the module is installed but redirect is still not working – user2018 Feb 02 '21 at 13:59