Gretyl's Portal

Heretto Help

Show Page Sections

Heretto Portal Redirects

Portal Redirects Overview

URL redirects, also referred to as URL forwarding, enable you to redirect the visitors of a Heretto Portal page to another portal page. Redirects are especially useful when restructuring content on your portal. When you move and update content in your sitemap, the URLs that lead to that content change. You can set up URL redirects to ensure your portal visitors get to the content even if they use the old URL. You set up redirects in your main portal sitemap.

You can set up redirects within one portal environment and between different portal environments.

You can also set up redirects for specific, individual pages as well as for sets of pages.

Redirects are especially helpful in these situations:

  • When you change your domain name. For example, your help site domain changed from docs.company-name.com to help.company-name.com.

  • When you are moving from a current documentation portal to Heretto Portal and the domain name is the same after the move.

  • When you update the names of parent elements in your sitemap. For example, when you change the name of a sitesection (navigational tile), topichead, or the title of a topic under which there is content.

  • When you move a single file or a group of files in the sitemap. For example, when you move a map from one sitesection to another.

Configure Redirects for Individual Pages

You configure redirects to ensure that when a page URL changes, users can still access the page with the old URL. Configuring redirects for individual pages doesn't require any specialized skills and can be done by any user with the right permissions.
  • Ensure you have the permissions to edit the main config.json file associated with your main portal sitemap.

  • Ensure that for each page for which you want to configure redirects you have a pair of old and new URLs ready.

Follow this procedure to configure redirects within one portal environment as well as between different portal environments.

  1. In the master branch, navigate to the main config.json file associated with your main portal sitemap.
  2. Right-click the config.json file and select Edit Source.
  3. In the Source Editor, scroll to the bottom of the file and, if not present, copy-paste the redirects section like shown here.

    ,
        "redirects": {
    		"pathRegExp": true,
            "paths": {
             }
        }

    Make sure you copy all the code and add the section exactly as shown in the video. The "pathRegExp": true, parameter enables the use of regular expressions in redirects. Regular expressions are necessary to configure redirects for sets of pages.

  4. Add the old and new paths in the paths section as presented here.

    Here are some important guidelines for configuring redirects:

    • Do not include the domain in the path

    • Do not use URLs but URIs (relative paths)

    • Ensure you include the quotation marks ("") and colon (:)

    • Separate multiple entries with commas (,)

    • Do not add a comma after the last redirect entry

    Tip:

    To add a comment in a .json file, use two forward slashes //.

    "redirects": {
    		"pathRegExp": true,
        "paths": {
          //A comment in a .json file 
          "/old/path/1": "/new/path/1",
          "/old/path/2": "/new/path/2" 
        }
      }

    Redirects within one portal environment. Let's say you changed a topic title from About Heretto CCMS to Heretto CCMS Overview and have these pairs of URLs and URIs:

    • Old page URL: https://help.heretto.com/en/heretto-ccms/about-heretto-ccms

      Old page URI: /en/heretto-ccms/about-heretto-ccms

    • New page URL: https://help.heretto.com/en/heretto-ccms/heretto-ccms-overview

      New page URI: /en/heretto-ccms/heretto-ccms-overview

    For this example, the redirect syntax in the config.json file would be:

    "redirects": {
    		"pathRegExp": true,
            "paths": {
                "/en/heretto-ccms/about-heretto-ccms": "/en/heretto-ccms/heretto-ccms-overview",
    	    "/old/path/2": "/new/path/2"
            }
        }

    Redirects between different portal environments. Let's say you are moving from your current documentation site to Heretto Portal and have these pairs of URLs and URIs:

    • Old page URL: https://old-site.com/releasenotes/releasenotes20223.html

      Old page URI: /releasenotes/releasenotes20223.html

    • New page URL: https://new-portal.com/en/discover/release-notes/2022.3-release-notes

      New page URI: /en/discover/release-notes/2022.3-release-notes

    For this example, the redirect syntax in the config.json file would be:

    "redirects": {
    		"pathRegExp": true,
            "paths": {
                "/releasenotes/releasenotes20223.html": "/en/discover/release-notes/2022.3-release-notes",
    	    "/old/path/2": "/new/path/2"
            }
        }
  5. Add as many redirects as needed.
  6. Save your changes.
  7. Validate your .json file.

    This syntax is very specific and won't validate if, for example, spaces are missing, or you have an extra comma. One option for validating the file is at https://jsonlint.com/.

  • Test the redirects by going to the old URLs. If the page opens at the new URL, your redirects are configured accurately.

  • Be sure to push the config.json file from the master branch to your staging and production branches. Publish the changes.

Configure Redirects for Sets of Pages

When a set of pages is affected by a single change, instead of configuring redirects for each page individually, you can configure redirects for the entire set. To do that, you need to use regular expressions (regex). We recommend that this configuration is done by users familiar with regex.

An example of a situation when a set of pages is affected by a single change is when the name of a sitesection (navigational tile) gets changed and therefore all links leading to content under that tile change.

  • Ensure you have the permissions to edit the main config.json file associated with your main portal sitemap.

  • Ensure that for each page for which you want to configure redirects you have a pair of old and new URLs ready.

Follow this procedure to configure redirects within one portal environment as well as between different portal environments.

  1. In the master branch, navigate to the main config.json file associated with your main portal sitemap.
  2. Right-click the config.json file and select Edit Source.
  3. In the Source Editor, scroll to the bottom of the file and, if not present, copy-paste the redirects section like shown here.

    ,
        "redirects": {
    		"pathRegExp": true,
            "paths": {
             }
        }

    Make sure you copy all the code and add the section exactly as shown in the video. The "pathRegExp": true, parameter enables the use of regular expressions in redirects. Regular expressions are necessary to configure redirects for sets of pages.

  4. Add the old and new paths in the paths section as presented here.

    Here are some important guidelines for configuring redirects:

    • Do not include the domain in the path

    • Do not use URLs but URIs (relative paths)

    • Ensure you include the quotation marks ("") and colon (:)

    • Separate multiple entries with commas (,)

    • Do not add a comma after the last redirect entry

    Tip:

    To add a comment in a .json file, use two forward slashes //.

    Redirects within one portal environment. Let's say you changed a sitesection name from Web Deployment to Heretto Portal and have these pairs of URLs and URIs:

    • Old page URL: https://help.heretto.com/en/web-deployment/

      Old page URI: /en/web-deployment/

    • New page URL: https://help.heretto.com/en/heretto-portal/

      New page URI: /en/heretto-portal/

    If you add this set of characters (.+)$ after the last forward slash in the old URI and this set of characters ${1} after the last forward slash in the new URI, then the redirect gets applied to all of the content contained in that sitesection. For this example, the redirect syntax in the config.json file would be:

    "redirects": {
        "pathRegExp": true,
        "paths": {
          //A comment in a .json file
          "/en/web-deployment/(.+)$": "/en/heretto-portal/${1}",
          "/old/path/2": "/new/path/2" 
          }
      }

    Redirects between different portal environments. Let's say you changed a sitesection name from Web Deployment to Heretto Portal and have these pairs of URLs and URIs:

    • Old page URL: https://old-site.com/releasenotes/

      Old page URI: /releasenotes/

    • New page URL: https://new-portal.com/en/discover/release-notes/

      New page URI: /en/discover/release-notes/

    If you add this set of characters (.+)$ after the last forward slash in the old URI and this set of characters ${1} after the last forward slash in the new URI, then the redirect gets applied to all of the content contained in that sitesection. For this example, the redirect syntax in the config.json file would be:

    "redirects": {
        "pathRegExp": true,
        "paths": {
          //A comment in a .json file
          "/releasenotes/(.+)$": "/en/discover/release-notes/${1}",
          "/old/path/2": "/new/path/2"
          }
      }
  5. Add as many redirects as needed.
  6. Save your changes.
  7. Validate your .json file.

    This syntax is very specific and won't validate if, for example, spaces are missing, or you have an extra comma. One option for validating the file is at https://jsonlint.com/.

  • Test the redirects by going to the old URLs. If the page opens at the new URL, your redirects are configured accurately.

  • Be sure to push the config.json file from the master branch to your staging and production branches. Publish the changes.