Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a site running on IIS 7.5 that does an automatic redirect from 'http://mysite.com/whatever.aspx' to 'http://www.mysite.com/whatever.aspx'

On the site, there is a lot of traffic to an old URL that I want to redirect to the front page, index.aspx: 'http://mysite.com/foo/bar/index.cgi%something=asdf&somethingelse=qwerty'

The problem is that no matter what I try, I can only get the redirect to work with the www subdomain. If I use the URL without www, I just end up at 'http://www.mysite.com/404.aspx'

Any ideas? Thanks in advance for all help!

Edit3: it seems like the browser caching the redirect response was messing with me, so edit2 is wrong. See my response below.

Edit2: disregard edit1, it doesn't seem like it's working after all.

Edit: here's some further info: using this article I've managed to redirect from 'http://mysite.com/foo/bar/index.cgi' to 'http://www.mysite.com/index.aspx', but if I add the query string parameters, it still redirects to 'http://www.mysite.com/404.aspx'

Isn't there a way to catch all requests to the cgi file, including query string parameters?

share|improve this question

1 Answer 1

So, I managed to get it working in the following way:

1) Add the subdirectory /foo/bar to the application in IIS
2) Add the file index.cgi in the subdirectory
3) Create the following webconfig in the subdirectory:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpRedirect enabled="true"  exactDestination="true" httpResponseStatus="Permanent">
      <add wildcard="*.cgi*" destination="http://www.mysite.com/index.aspx" />
    </httpRedirect>
  </system.webServer>
</configuration>

That catches all requests to index.cgi, but that works for me. I could probably have gotten it to work with just the URL I specified over, but it's not needed.

share|improve this answer
    
You could use URL Rewrite module and do all this without creating folders/index.cgi -- learn.iis.net/page.aspx/664/using-url-rewrite-module-20 –  LazyOne Jul 2 '12 at 10:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.