views:

116

answers:

2

Is it possible on an IIS to redirect all files with the file extension .asp to one single file (i.e. switch.php, switch.cfm) and how? Thx in advance for the upcoming solutions :)

EDIT: version of IIS is "IIS 6.0"

+2  A: 

Here’s a few different thoughts off the top of my head:

  1. Use an ISAPI filter. Either write your own or use a commercial one like Helicon ISAPI Rewrite (the reverse proxy feature should be able to do this).
  2. Add a global.asa file to the root of the site and Response.Redirect to the page you want in the Session_OnStart event (I think this event still fires if the requested page doesn’t actually exist but am not 100% sure). More info here.
  3. Define a new 404 “File not found” page in IIS which loads a custom page with a redirect to your desired URL. You could do this with either client or server side script and make it conditional on the requested URL having a .asp extension so as not to catch genuine 404s for other file types.

I’d say option 1 is your “best practice” approach but option 3 would get you up and running very quickly. Good luck!

Troy Hunt
A: 

your going to want to look into "iis modrewrite" on google :)

lets you use regular expressions to define rules and you can set a global match to rewrite to 1 page

Carter Cole