简体   繁体   中英

Bind a domain name to a website in IIS Based on URL

Is it possible to bind a domain name to a website instance in IIS (Version 8.5) using a directory rather than a sub or second level domain?

For example:

  1. domain.com/ = website1
  2. domain.com/directory/ = website2

In the above example, instance 1 will obviously pick up both requests made in instance 1 and 2. I don't want to use a redirect.

Can anyone advise me on options?

Many thanks

I think what you need is IIS reverse proxy. It use ARR and URL rewrite to do URL rewrite instead URL redirection.

You can easily rewrite ^/$ to website1 and ^/directory/$ to website2 with ARR.

Please install Application request routing and URL rewrite from Web platform installer. Then enable proxy in IIS manager->server node->application request routin cache->Server proxy setting->Enable Proxy.

Finally, you can input your rewrite rule in web.config.

https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM