I have an asp.net application on sub domain sub.domain.com I want to access this application by typing www.domain.com/sub is it possible with IIS7?
            Asked
            
        
        
            Active
            
        
            Viewed 1,343 times
        
    1
            
            
        - 
                    Do you need to do this automatically or are you happy to manually configure this? – Ash Eldritch Aug 03 '11 at 10:11
 - 
                    Also, do you have an existing application at www.domain.com/ that you want to preserve? – Ash Eldritch Aug 03 '11 at 10:13
 - 
                    I can do it manually. And yes I have an application working on www.domain.com. – zer0w1dthspace Aug 03 '11 at 10:17
 
1 Answers
3
            Assuming you're happy to manually configure the application at each subdomain:
- In IIS Manager, go to Sites, and select your www.domain.com site.
 - Right click it, "Add Application" and specify the alias "sub" and point the physical path to the same location as sub.domain.com
 - Select the same application pool as the sub.domain.com site.
 
Alternatively you could set up a redirect by creating a new Virtual Directory in your www.domain.com site, then dropping in a default.html file that does a http redirect.
A posher (and more transparent to the user) redirect could be done like so:
- Open an elevated command prompt
 run the following command:
%windir%\system32\inetsrv\appcmd set config "nameofsite/virtualdirectoryname" -section:system.webServer/httpRedirect -enabled:true -destination:destinationofredirect -commitpath:apphost
I lifted that from: http://www.andrewwestgarth.co.uk/Blog/post/2008/07/31/Creating-Http-Redirects-in-IIS7-on-Virtual-Directories-like-IIS6.aspx
        Ash Eldritch
        
- 1,504
 - 10
 - 13