Use websites instead of virtual directories (applications) in IIS

Virtual directories - applications
Virtual directories and applications have similar functions in IIS. Both terms are sometimes used interchangeably.
Virtual directories and applications have been separate objects since IIS 7.
More information about this is available here: Understanding Sites, Applications, and Virtual Directories on IIS 7

We will use the term virtual directory in the next chapters. In the narrower sense, it refers to applications. These are represented by the following icon in IIS:

You can no longer use virtual directories in IIS as of Intrexx 20.09.
We recommend that you use websites instead of virtual directories with Intrexx 19.03 or later.

What are virtual directories in IIS?

Up to and including Intrexx 19.03, you could use virtual directories in IIS to define the URL that is used to reach the portal in the browser. The virtual directory was usually created under "Default Web Site" in IIS.



In the browser, you could then access your portal by entering your domain and the virtual directory.


Example

Your domain (host name) exampledomain.com
Portal name (in the portal properties) exampleportal
Name of the virtual directory / Alias exampleportal
URL https://exampledomain.com/exampleportal/

You could run multiple portals with the same domain or host name but with different virtual directories.
The corresponding URLs could look like this, for example:

URL https://exampledomain.com/exampleportal-1/
URL https://exampledomain.com/exampleportal-2/
URL https://exampledomain.com/exampleportal-3/

What are websites IIS?

In the context of your portal's URL, websites have a similar function to virtual directories in IIS.
When creating a website in IIS, you can enter the URL, which is used to access the portal in browser, in the "Host name" field.



The website looks like this in the navigation area on the left of IIS:



You can access the portal in the browser by entering the host name defined here and your domain.


Example

Your domain (host name) exampledomain.com
Portal name (in the portal properties) exampleportal
Host name in IIS exampleportal.exampledomain.com
URL https://exampleportal.exampledomain.com

A key difference between using virtual directories and websites when running multiple portals is that you need to create a website in IIS for each portal.
The corresponding URLs look like this:

URL https://exampleportal1.exampledomain.com
URL https://exampleportal2.exampledomain.com
URL https://exampleportal3.exampledomain.com

What are the advantages of websites?


How to switch from existing virtual directories to websites

  1. Create a website for every virtual directory (cf. Add a website in IIS). Apply the binding settings from the Default Web Site to your new site.
  2. Stop the Default Web Site.



So that your links that refer to virtual directories continue to work correctly, we recommend that you add one or more redirect rules in the URL rewrite module in ISS.
The section below provides a detailed guide to configuring a redirect rule in IIS.
Please consult the IIS online help if needed: https://www.iis.net/.

Step-by-step guide

To configure a redirect rule for a URL with a virtual directory to a URL with a website, please proceed as follows:
  1. Start IIS.
    Please make sure that you have selected the first entry on the left (under "Start Page").
  2. Click on the "URL Rewrite" icon.



  3. Click on "Open Feature".
    (Alternatively, you can double-click on the "URL Rewrite" icon.)



    You will now be on the "URL Rewrite" page.
  4. Click on "Add Rule(s)..." under "Actions" on the right.



    The "Add Rule(s)" dialog will open.
  5. Select "Blank rule".



  6. Click on "OK".
    The "Edit Inbound Rule" page will open.



    The most important fields for configuring the redirect are Pattern and Rewrite URL.

    Name Description
    Name Provide the redirect rule with a name here.
    Requested URL Select "Matches the Pattern" from the list.
    Using Select "Regular Expressions" from the list.
    Pattern Enter the name of the virtual directory with a closing backslash.
    Test pattern... You can test the redirect with this button.
    Ignore case Activate this checkbox.
    Conditions Please refer to the IIS online help as to whether you should use conditions.
    Server Variables Please refer to the IIS online help as to whether you should use server variables.
    Action type Select "Rewrite" from the list.
    Redirect URL Enter the URL of your portal with a closing backslash.
    Append query string Activate this checkbox.
    Redirect type Select the value "Permanent (301)".
  7. Click on "Apply" on the right.



    You will now retun to the "URL Rewrite" page.
    The rule you just created will now appear in the list.
    You have now configured a redirect rule for a URL with a virtual directory to a URL with a website.