Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create URL Redirection on Windows Using IIS

URL redirection is a technique used to make a web page available under more than one URL address. This is commonly used for forwarding users from an old URL to a new one, or for managing traffic between different domains. In a Windows environment, particularly with Internet Information Services (IIS), URL redirection can be configured easily. This article will guide you through the process of setting up URL redirection using IIS on a Windows server.

Examples:

Example 1: Setting Up a Basic URL Redirection in IIS

  1. Open IIS Manager: You can open IIS Manager by typing inetmgr in the Run dialog (Win + R) and pressing Enter.

  2. Select the Website: In the Connections pane, expand the server node and select the site you want to configure redirection for.

  3. Open URL Rewrite Module: Double-click on the "URL Rewrite" feature in the middle pane. If you do not see this option, you may need to install the URL Rewrite module for IIS.

  4. Add a New Rule: Click on "Add Rule(s)..." in the Actions pane on the right.

  5. Select Rule Type: Choose "Blank rule" under the "Inbound rules" section and click OK.

  6. Configure Rule:

    • Name: Give your rule a descriptive name, e.g., "RedirectOldPage".
    • Match URL: Set the requested URL pattern you want to match, e.g., ^oldpage$.
    • Conditions: You can add conditions if needed, but for a basic redirect, this can be left empty.
    • Action: Set the action type to "Redirect". Enter the new URL in the "Redirect URL" field, e.g., http://www.example.com/newpage. Choose the appropriate redirect type (e.g., Permanent (301) or Temporary (302)).
  7. Apply Rule: Click "Apply" in the Actions pane to save the rule.

  8. Test the Redirection: Open a web browser and navigate to the old URL to ensure it redirects to the new URL as expected.

Example 2: Redirecting HTTP to HTTPS

  1. Open IIS Manager and navigate to the site you want to secure.

  2. Open URL Rewrite Module and add a new rule as described in the previous example.

  3. Configure Rule:

    • Name: "RedirectHTTPtoHTTPS".
    • Match URL: Use the pattern (.*) to match all URLs.
    • Conditions: Add a condition to check if the HTTPS server variable is off:
      • Condition input: {HTTPS}
      • Check if input string: Matches the Pattern
      • Pattern: ^OFF$
    • Action: Set the action type to "Redirect". Enter https://{HTTP_HOST}/{R:1} in the "Redirect URL" field. Choose "Permanent (301)" for the redirect type.
  4. Apply Rule and test by navigating to the HTTP version of your site to ensure it redirects to HTTPS.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.