3 minute readApplies to: v4

How to configure a redirect using the IIS Rewrite module

What is the IIS Rewrite Module?

The IIS Rewrite Module is a tool used to convert complex web addresses into consistent, memorable, URL's. The rewrite module produces URLs which are simple for users to remember and for search engines to find.

The rewrite module is based on HTTP headers and IIS server variables. It performs redirects, sends custom responses, or stops HTTP requests based on the logic expressed in the rewrite rules. Access to web site content is controlled by URL segments or metadata.

More information on the IIS rewrite module and its features can be found here.

See the following on how to create a redirect rule to switch traffic to a custom Squared Up instance.

Configure the Redirect

  1. Ensure that you are using IIS 7 or above.

  2. Download and install the IIS rewrite module version 2.0, the latest download link for this can be found here.

  3. Close and re-open IIS to ensure that the URL Rewrite module loads.

  4. On the left hand panel click on Default Website and then double click on URL Rewrite from the main panel.

  5. Under Actions in the right panel select Add Rule(s)...

  6. With Blank rule selected click OK.

  7. Create a meaningful name for your rule, e.g Root Hit Redirect

  8. In the pattern section enter the regular expression ^$ as shown below, this asserts position at the start and end of the string entered.

    Requested URL: Matches the Pattern

    Using: Regular Expressions

    Pattern: ^$

  9. In the Action section add the following:

    Action Type: Redirect

    Redirect URL: /SquaredUpv4

    Redirect Type: Found (302)

    We recommend the use of a 302 temporary redirect. Do NOT use 301 which is a permanent redirect and difficult to change at a later date.

  10. Ensure Append query string is ticked. This is will add /SquaredUpv4 to the URL and redirect the user to their dashboard.

  11. On the right-hand side under Actions click Apply.

Found (302)

HTTP to HTTPS

To set a redirect to redirect all HTTP to HTTPS requests use the following steps:

  1. Open IIS.

  2. On the left hand panel click on Default Website and then double click on URL Rewrite from the main panel.

  3. Under Actions in the right panel select Add Rule(s)....

  4. With Blank rule selected click OK.

  5. Enter Redirect to HTTPS in the name field.

  6. Within the Match URL configuration box we will set the following settings:

    Requested URL: Matches the Pattern

    Using: Regular Expressions

    Pattern: (.*)

  7. Select Conditions and press Add… to add a new condition to the configuration.

  8. Add the following condition:

    Condition Input: {HTTPS}

    Check if input string: Matches the Pattern

    Pattern: ^OFF$

  9. In the Action section add the following:

    Action Type: Redirect

    Redirect URL: https://{HTTP_HOST}/{R:1}

    Redirect Type: See Other (303)

    See Other (303)

  10. On the right-hand side under Actions click Apply, then click Back to Rules.

If you have BOTH of these rules set up ensure that you move your HTTP redirect, to be listed above your SquaredUp re-direct as shown in the image below.

Rewrite

How to install Squared Up v4 for the first time

Deployment FAQ

Squared Up Ltd. (c) 2018Report an issue with this article