• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 543
  • Last Modified:

IIS 7 default document

Dear Experts,

How to set different default document for different domain that point to the same folder?
for example.

Domain www.example.com 
default document: index.aspx
point to folder: c:\websites\example\

Domain test-1.example.com
default document: index.aspx?id=test1
point to folder: c:\websites\example\

Domain test-2.example.com
default document: index.aspx?id=test2
point to folder: c:\websites\example\

Please advise how to make above case works, as the iis7 setting use the shared web.config for default document.

Thank you.
1 Solution

You have to click on website name in IIS7 -> Double Click on Default Document -> Click on index/default page which you want to set -> Set it on top using Move UP button in the right

You have to these steps for all the websites.
best way of browsing with other defaults is

follow the url:
1: http://www.example.com 
2: http://www.example.com/index1.aspx
3: http://www.example.com/index2.aspx

you can all three links from above urls.

thats all
This can be done by putting the default document into the applicationhost.config, instead of the web.config.

To do this, remove the entries in the web.config.

Then run the following command for each of your websites below.

Replace    test-1 website     with the friendly name of your website in IIS.

Check here for reference:

%windir%\system32\inetsrv\appcmd.exe set config "test-1 website" -section:system.webServer/defaultDocument -+files.[value='Connectindex.aspx?id=test1'] -commitpath:apphost

Open in new window


Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now