IIS - two sites under one domain - best way to achieve this?

144 Views Asked by At

I read a lot articles and questions here on stackoverflow. But I am not quite sure which solution fits my needs.

I have a two sites in IIS. https://example.com and https://career.example.com

Both have different physical paths on the same server. Both use different CMS and are websites.

I want the subdomain site to be accessed under a subolder instead: https://example.com/career/

The subfolders also should be available under the new path.

e.g. https://career.example.com/job1 should be https://example.com/career/job1

The solutions go from simple redirects in the site of the subdomain, to virtual directories, or changing bindings and adding new ones under the main domain....

I am not sure which way to go.

Do you recommend a solution?

1

There are 1 best solutions below

4
YurongDai On

If you want the subdomain site to be accessed under a subolder instead, that is, when you go to the URL like https://example.com/career/job1 in the browser address bar, the content of the webpage you actually access is https:/ /career.example.com/job1. Please correct me if I understand wrong.

To achieve this, you need to use Reverse Proxy with URL Rewrite and Application Request Routing. The specific implementation steps are as follows:

  1. You need to enable reverse proxy in IIS. If you have not installed the ARR module, you need to download and install it first.

enter image description here

  1. Then you need to add reverse proxy rewrite rules under https://example.com site. The rule in web.config as follow:

enter image description here

You can refer to this document to learn more about Reverse Proxy with URL Rewrite and ARR.