Under maintenance

Heretto Help

Show Page Sections

Manual Redirects

Manual redirects enable users to manually set up URL redirects between portal environments to address situations automatic redirects do not handle. For example, when your domain changes or you move from a current documentation portal to Heretto Portal. Manual redirects are set up in the config.json file associated with the main portal sitemap.

Manual redirects are especially helpful in these situations:

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

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

Important Considerations

  • Automatic redirects manage redirects for any URL changes within Heretto Portal. If you do configure manual redirects, they override automatic redirects. For details, see Automatic Redirects.

  • Only set up manual redirects when you're moving from a current documentation site to Heretto Portal.

  • Manual redirects are supported in active sync and manual deployments.

Configure Redirects for Individual Pages

You can manually configure URL redirects for individual pages in different portal environments by adding them to the config.json file linked to your main portal sitemap. This method supports scenarios not covered by automatic redirects.

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 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" 
        }
      }

    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

You can manually configure URL redirects for sets of pages in different portal environments by adding them to the config.json file linked to your main portal sitemap. This method supports scenarios not covered by automatic redirects.

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.

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

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

Follow this procedure to configure redirects 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 //.

    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.