How to Configure Redirect Page Rules on VergeCloud for Effective Website Redirection

Setting Up Redirect Page Rules on VergeCloud: Guide to Managing Website Redirects

Redirect Configuration

In this section, you can learn how to direct traffic from a specific URL to another within the Page Rules area. To begin, navigate to the Page Rules section of your user panel under the VergeCloud CDN service and select the option to Add New Rule.

Glossary

  • Redirect: A method for sending users from one URL to another.
  • Page Rules: Settings that allow you to modify how your website behaves.
  • HTTP Status Codes: Numeric codes that represent the result of a server's response to a browser request.

Real Usage Scenarios

A practical example would be if your website has moved to a new domain and you want to ensure that visitors using the old URL are seamlessly redirected to the new address.

Field/Option Descriptions

  1. URL: In the new window that appears, enter the URL you wish to redirect (for example, www.example.com).

    ![Image Placeholder](image-placeholder.png)

  2. Redirect Option: Choose the Redirect option from the dropdown menu.

    ![Image Placeholder](image-placeholder.png)

  3. Status Activation: Activate the status and select one of the following codes: 301, 302, or 307.

    ![Image Placeholder](image-placeholder.png)

HTTP Status Codes Explained

  • Code 301 (Permanent Redirect): This indicates that the URL has permanently changed to a new one. It informs search engines that the new URL replaces the old one indefinitely. If you intend to retain the old URL while making a temporary change, utilize the 302 redirect code instead.
  • Code 302 (Temporary Redirect): This code signifies a temporary move, suggesting that while the content is accessible, it is located at a different URL. Use this when you want to redirect visitors temporarily without altering the search engines' indexing of the original URL.
  • Code 307: Similar to the 302 code, but specifically for HTTP/1.1. This code ensures that the request method remains unchanged during the redirection process, while the 302 code may alter the request method from POST to GET in HTTP/1.0.

Once you have selected your code, input the domain you wish to redirect from in the URL section and click on Create.

Advanced Redirect Settings

The basic Page Rules settings enable straightforward redirection. However, if the main domain has multiple source URLs, the redirection may not function correctly. For instance, if you are redirecting from:

  • sample.com to newsample.com

Requests to sample.com/example.html will still redirect to newsample.com instead of the ideal newsample.com/example.html.

To address this, you need to employ variables within the page rule. Access the Page Rules section of your VergeCloud account under the CDN tab and select Add a New Rule.

  1. Input URL: Enter the URL and click the + icon to add the rule.

    ![Image Placeholder](image-placeholder.png)

  2. Select Redirect: In the new window, click on Redirect and choose one of the codes: 301, 302, or 307.

    ![Image Placeholder](image-placeholder.png)

  3. Destination URL: Enter the new URL for redirection. You can incorporate asterisks (*) to represent variables within the URL. For example:
    • sample.com/*
    • *.sample.com
    • sample.com/new/*.jpg

    Note: The query string will not be redirected between the source and destination URLs in the examples above.

    ![Image Placeholder](image-placeholder.png)

  4. Variable Syntax: Ensure the destination address uses the syntax with $ followed by a number, like so:
    • newsample.com/$1
    • $1.newsample.com

    Additionally, a single address can accommodate multiple variables; for example, *.sample.com/*. Here, $1 refers to the first variable, $2 to the second, and $n to the nth variable.

    Example: $1.newsample.com/$2

    ![Image Placeholder](image-placeholder.png)

Once you have configured all settings, click on Add a New Rule to save and apply the changes.

Testing and Validation

After configuring your redirect, to verify its functionality, you can open a browser and navigate to sample.com/example.html. You should be automatically redirected to newsample.com/example.html.