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.
Who is Participating?
Springy555Connect With a Mentor Commented:
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


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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.