Creating Redirection Rules

Modified on Wed, 9 Sep at 5:25 AM

You can redirect a request for a URL within your Hub to another URL within or outside the Hub by defining a Redirection Rule. The Redirection rules allow you to seamlessly direct traffic from one URL to another. It is particularly useful for preventing 404 errors and routing visitors to the correct locations on your site.


Redirect Rule with an Example

Let's assume we have a space called "Case Study" that is based on the URL (https://companyhub.com/case-study). The Admin later decides to change the name of the space to "Case Studies" and changes the URL to (https://companyhub.com/case-studies). Most links inside the Hub will automatically be updated to accommodate this change but links from outside the application (such as those cached by Google or by your users' browser bookmarks) will no longer resolve. 


To resolve this discrepancy, navigate to the Hub's Redirection Rules page (Hubs > Rules & Automation > Redirection Rules) and set up a simple redirection rule that points Source path: /case-study to Destination path: /case-studies or use a regular expression to set up a new redirection rule that points Source path: ^/case-study/(.*)$ to Destination: /case-studies/$1. Now, whenever a user follows a link to (https://companyhub.com/case-study), they will be redirected automatically to (https://companyhub.com/case-studies).


To create a redirection rule:

  1. From the Left Navigation Menu, click Hubs. On the Hubs listing page, select the Hub you want to manage. From the Hub Menu, under RULES & AUTOMATION, click Redirection Rules. 
  2.  On the Redirection Rules listing page, click + New Rule 
  3. On the New Redirection Rule page, fill in the following sections: Incoming request, Destination, URL parameters and Status. Then click Save rule.

    Incoming request

    The Incoming request specifies the path that a visitor arrives on.

    Match type

    Select how the incoming URL should be matched:

    • Exactly — Matches only the specified source path.
    • Starts With — Matches URLs that begin with the specified source path.
    • Matches — A regular expression matched against the visitor's path.

    Source path

    Enter the URL path that you want to redirect. For example: /resources/2023-buyers-guide

    Note: The source path must begin with /. Do not include spaces, ?, or & in the source path. The source path shall contain 500 characters max. To add URL parameters, use the URL parameters options instead.


    Destination

    The Destination specifies where the visitor is sent after the redirect.

    Enter the Destination path. For example: /guides/buyers-guide

    Relative paths keep the visitor within the Hub. To redirect visitors to an external website, enter the complete URL, including https://.

    Redirect Type

    Choose one of the following redirect types:

    • Permanent 301 — Permanently redirects visitors to the new path and passes search ranking signals to the new URL.
    • Temporary 302 — Temporarily redirects visitors to another path. Use this option when a page is being reworked or the redirect is temporary.


    URL parameters

    Use URL parameters to preserve or add parameters to the destination URL.

    Select Carry over the visitor's parameters to copy the parameters from the incoming URL to the destination. For example, parameters such as utm_source and gclid are carried over to the destination.

    Always add these parameters. Enter parameters that should be added to every redirect created by this rule. For example, ref=redirect&campaign=guides. Use key=value pairs separated by &. Do not include / or ?.


    Status

    The Status section indicates whether the rule is active.  Active rules take effect on the hub as soon as you save.


Related Articles:

Editing and Deleting a Redirection Rule

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article