I've got three subdomains: dev.mydomain.com
, archive.mydomain.com
, and www.mydomain.com
.
Would it be possible to create a web.config
file that will map requests to a given subdomain to a folder sitting in the webroot that matches that subdomain?
E.g. if my D:\inetpub
folder contains dev\index.cfm
, archive\index.cfm
, and www\index.cfm
, i'd like to map requests to http://dev.mydomain.com/index.cfm
to the first, http://archive.mydomain.com/index.cfm
to the second, and http://www.mydomain.com/index.cfm
to 开发者_开发问答the third.
Thanks for your consideration!
I'd recommend that you look into URL Rewriting for this. There's some great paid and free ones out there. They take all requests at the IIS level, compare them to a regular expression table and silently re-map and URLs that you specify.
Depending on what you go with your expressions would be something like:
RewriteCond %{HTTP_HOST} ^(dev|archive|www).mydomain.com$
RewriteRule ^/(.*)$ /$0/$1 [F]
You can do this simply on IIS by using host headers.
精彩评论