How do I redirect a directory's default file with IIS7?

10,124

If you create default.aspx and redirect it to another page, the other pages should still work.

In IIS Manager, right click the default.aspx page, select properties, select the radio button for A redirection to a URL. Enter the redirection URL and click OK.

In IIS 7, drill down to the page in Content view, then when you click the page select Switch to Features View and select HTTP redirect.

Share:
10,124
Jeff
Author by

Jeff

Interested in .NET, ASP.NET, C#, VB, (X)HTML, CSS, JavaScript, bjj, snowboarding, mountain biking and Jesus.

Updated on September 18, 2022

Comments

  • Jeff
    Jeff over 1 year

    I want the default document in a folder to redirect to another URL but I still want other files in the same directory to be served normally. How can I do this in IIS 7? For example:

    my-site.com/              => redirects to http://example.com
    my-site.com/default.aspx  => redirects to http://example.com
    my-site.com/foo.aspx      => served normally
    
  • Jeff
    Jeff about 12 years
    Are these instructions for IIS 7? I don't see Properties when I go into Content View and right click the file.
  • uSlackr
    uSlackr about 12 years
    edited my answer
  • Jeff
    Jeff about 12 years
    Oh, ok. That makes sense. I tried that and IIS is redirecting for /default.aspx but not /. Is it supposed to redirect for both?
  • uSlackr
    uSlackr about 12 years
    if you redirect / I believe it will not allow you to get inside the directory. The default file should be sufficient.