问题
So Currently I have a site accessible by http://hostname/myvirtualdirectory/home.aspx
If you go to http://hostname/myvirtualdirectory
it automatically goes to home.aspx... good!
However when I go to http://hostname
it gives the IIS start page.
Question 1:
How do I make this redirect to the virtual directory myvirtualdirectory/home.aspx
I have pointed a subomdain mysubdomain.myurl.com
at the server, everything works pretty much the same if I go to http://mysubdomain.mysite.com/
I get the start page but going directly to http://mysubdomain.mysite.com/myvirtualdirectory
does go to the home.aspx page
Question 2 Once I point everything correctly in the answer to question 1 do I need to do anything extra to handle the subdomain?
Thanks!
回答1:
I'm going to assume you're using IIS 7.0 or above.
Answer to question 1)
Ensure you have the HTTP Redirection
feature installed, and then setup a redirct on the root website, details here: http://www.iis.net/configreference/system.webserver/httpredirect
Answer to question 2) You don't need to do anything extra to handle the sub domain unless you've set up multiple websites on the server, from your question I'm guessing that's not the case.
来源:https://stackoverflow.com/questions/19386465/iis-point-new-subdomain-to-existing-virtual-directory