---
title: "Path constraints and link exclusions"
date: "2021-12-16T11:58:59+00:00"
summary: "Learn how to set up path constraints and link exclusions for efficient website scanning and crawling."
image:
type: "page"
url: "/web-governance/path-constraints-and-link-exclusions"
id: "d337ce00-1524-4fb0-b5cb-d891a3c53ff7"
---

Table of contents will be added

Introduction
------------

This article provides instructions and examples for how to set up path constraints and link exclusions for the scan.

Use path constraints to process all pages that begin with the parameter you set. If you plan to do the scan on a path-based domain, you must set up path constraints because the crawler processes everything it can find on the domain.

Use link exclusions to exclude a word or a Regular Expression (regex). This instructs the crawler to completely ignore a link on the pages. Pages that match the pattern are not tested. Exclude parameterized or duplicate URLs to help prevent inflated page counts and ensure that the scan results accurately reflect the unique content on your site.

Path constraints
----------------

This section provides instructions and examples on how to set up path constraints. 

Notes

*   Path constraints are regexes.
    *   A regex is an API that defines string patterns. Use a regex to search, manipulate, and edit a string in Java. Email validation and passwords are two examples of strings where a regex can define the constraints.
*   Regexes in source code exclusions are not 100% compatible with the Policies module. The languages are different (Java and Ruby).

### Instructions

1.  Log in to Web Governance. The system displays the Domain Overview.
2.  Click **Action** on the same row as the domain that you want to work with and select **Edit Domain**.
    
    ![The location of the Action button and the expanded list of options, on the same row as a domain.](https://acquia.widen.net/content/2awm1ut1yx/web/WebGov_DomainOverview-ActionButtonAndMenu.png?w=720&v=5721cbb7-fb99-405b-af36-756fe71843bb&itok=GENWF0wt)
    
3.  Scroll to the **Advanced Domain Options** section.
4.  Complete the requested information in the **Path Constraints** section:
    *   **Constraint pattern**: Enter a constraint pattern. See the Examples section below for an example of a constraint pattern.
5.  To add more, click **+Add**.

Notes

*   The window only shows the first five items. With more than five list items, a paginate function sorts the list items. Use the Search feature to filter for specific constraints.
*   Some CMS selections have pre-filled parameters, as per the majority of users with those CMS operators. Click **Default** to remove them if needed. The **Default** button only appears for certain operators.

### Examples

Use _Path Constraints_ to instruct the scan to only process parts of a domain. The scan processes URLs that match the pattern, and ignores URLs that do not match the pattern.

A Path Constraint can consist of a word or a regex. In most cases, users set up _Path Constraints_ to restrict the scanner to only recognize parts of a site with a specific pattern. 

*   For example: `/en/`
    
    This constraint instructs the scan to handle any URL that does not begin with /en (such as, `http://foo(dot)com/fr/bar`) as an external link. For example, the crawler tests the link to verify that it is operational, but does not follow any links on `http://foo(dot)com/fr/bar`_._
    

Important

Make sure that the URL for the domain is set to a page that matches the constraint. If this is not done, only one page will be included in the scan, since the crawler cannot proceed to any other page than the page it starts on.

For example, with a constraint of: `^/en/booking`, the crawler cannot start on http://foo(dot)com. The crawler will request http://foo(dot)com, receive the page, and find that no links match http://foo(dot)com/en/booking. Because of this, only the first page is scanned.

Notes

*   Regexes in path constraints are not 100% compatible with the Policies module. The languages are different (Java and Ruby).
*   For more information and examples, visit the external article [Class Patterns by Oracle](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html).

Link exclusions
---------------

This section provides instructions and examples on how to set up the link exclusions. Link exclusions are regexes.

Notes

*   A regex is an API to define String patterns. Use a regex to search, manipulate, and edit a string in Java. Email validation and passwords are two examples of strings where Regex can define the constraints.
*   Regexes in link exclusions are not 100% compatible with the Policies module. The languages are different (Java and Ruby).

Choose to exclude a word or a regex. Use a _Link Exclusion_ to instruct the crawler to completely ignore the link. Pages that match the pattern are not included in the scan. Exclude parameterized or duplicate URLs to help prevent inflated page counts and ensure that the scan results accurately reflect the unique content on your site.

Use link exclusions to:

*   Filter out print pages with a pattern such as `print&#x3D;true`.   
    This instructs the scan to ignore (and not test) any URL with the pattern, for example `http:/ /foo.com/bar?print&#x3D;true`_._
*   Filter out redirected login pages with a pattern such as `http://foo(dot)com/bar/login.aspx?return_url&#x3D;zyx.</i`_._  
    This instructs the scan to ignore all URLs with the pattern, for example: `http://foo(dot)com/bar/login.aspx?return_url=zyx`_._
*   Exclude parameterized URLs to avoid inflated page counts. For example, add a pattern like: `posts_per_page=` to instruct the scan to exclude URLs such as `http://foo.com/bar?posts_per_page=10.>`
    

_Tip!_ If "Scan subdomains" is turned on for the domain, use the **§** sign in front of the exclude pattern to match URLs that use the full string instead of the relative one. For example, to exclude the scan for the "blog" subdomain, enter as the pattern: `§http://blog.foo.bar`

### Examples

This section provides a few examples on how you can use a link exclusion to instruct the scan to ignore parts of the site with a particular pattern. 

Use link exclusions to:

*   Filter out print pages with a pattern such as `print&#x3D;true`.   
    This instructs the scan to ignore (and not test) any URL with the pattern, for example `http:/ /foo.com/bar?print&#x3D;true`_._
*   Filter out redirected login pages with a pattern such as `http://foo(dot)com/bar/login.aspx?return_url&#x3D;zyx.</i`_._  
    This instructs the scan to ignore all URLs with the pattern, for example: `http://foo(dot)com/bar/login.aspx?return_url=zyx`_._
*   Exclude parameterized URLs to avoid inflated page counts. For example, add a pattern like: `posts_per_page=` to instruct the scan to exclude URLs such as `http://foo.com/bar?posts_per_page=10.>`
    

_Tip!_ If "Scan subdomains" is turned on for the domain, use the **§** sign in front of the exclude pattern to match URLs that use the full string instead of the relative one. For example, to exclude the scan for the "blog" subdomain, enter as the pattern: `§http://blog.foo.bar`

For example:  
`/fr/`

*   This instructs the scan to process any URLs that begin with /fr (for example, http://foo(dot)com/fr/bar) as an external link. 
*   This means that the scan tests the link but does not follow any links on `http://foo(dot)com/fr/bar`.
*   The scan processes all pages EXCEPT for those that contain `/fr`.

### Instructions

There are two methods to use for setting up link exclusions in Web Governance.

*   Method 1: Through the domain **Action** button.
*   Method 2: Through **Admin settings**.

#### Method 1

1.  Log in to Web Governance and locate your domain on the Domain Overview page.
2.  On the same row as the domain that you want to work with, click **Action** and select **Edit Domain** from the drop-down list.
    
    ![The location of the Action button and the expanded list of options, on the same row as a domain.](https://acquia.widen.net/content/2awm1ut1yx/web/WebGov_DomainOverview-ActionButtonAndMenu.png?w=720&v=5721cbb7-fb99-405b-af36-756fe71843bb&itok=GENWF0wt)
    
3.  Scroll to the **Advanced Domain Options** section.
4.  Complete the requested information in the _Link excludes_ section:
    *   **Exclude pattern**: Enter a pattern to exclude from the scan.
        
        Notes
        
        *   The window only shows the first five items. With more than five list items, a paginate function begins to sort consecutive list items.
        *   **Search**: Enter a search parameter for matching strings within the _Link excludes_ list.
        
    *   **Internal URLs:**
        *   **Operator**: Click the drop-down arrow to select _Contains_, _Starts with_, or _Regex_.
        *   **URL**: Enter a URL in the field.
5.  **\+ Add**: Click to add a new _Input Selector_ row if needed.
    
    Important
    
    It is possible to do a link exclusion for a link that is attached to an image. The _link_ is then excluded from the scan. However, the image itself could still appear on the SEO and QA pages as an issue to be fixed if it does not meet other requirements (for example, missing ALT text).
    

For more information and examples, visit the external article [Class Patterns by Oracle](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html).

#### Method 2

1.  Log in to Web Governance.
2.  Click **Admin settings** (the gear icon) on the main menu bar.
3.  Select **Add a scan exclusion**.
    
    ![The Web Governance Admin dashboard.](https://acquia.widen.net/content/3v9qva0wgr/web/WebGov_AdminDashboard.png?w=720&v=7bbd9a3f-6a18-41d0-81fd-c71976a33b22&itok=wNi-1vBy)
    
4.  On the _Add scan exclusion_ page, provide the requested information.
    
    ![The Add scan exclusion page. The relevant fields are described in the document text.](https://acquia.widen.net/content/jpazykpusa/web/WebGov_AdminSettings-AddScanExclusionPage.png?w=720&v=85554092-e9f0-4172-a2bc-08b890ec46f6&itok=2KOngTUR)
    
    *   Select the type of scan exclusion you want to add. Choose one of the following:
        *   Accessibility
        *   Misspellings
        *   Language validation
        *   Readability

##### Accessibility scan exclusion

*   **Title**: Describe the exclusion in the space provided.
*   **Auto-apply to domain with CMS**: Click the drop-down arrow and select your CMS from the list.
*   **Apply exclusion to domains**: Click the drop-down arrow and select the domains that you want to include in this link exclusion.
*   **HTML exclusion**: Exclude elements based on their name in the page source code.
    *   **Type**: Click the drop-down arrow and select a type from the list.
        *   Exact
        *   Regex
        *   Contains
    *   **Value**: Enter the HTML source code snippet that you want to exclude.
    *   **Checks**: Click the drop-down arrow and select all of the accessibility checks that you want to exclude.
*   Click **+Add exclusion** to add more exclusions.

##### Misspellings, Language validation, and Readability scan exclusions

*   **Title**: Enter a description for the exclusion in the space provided.
*   **Auto-apply to domain with CMS**: Click the drop-down arrow and select your CMS from the list.
*   **Apply exclusion to domains**: Click the drop-down arrow and select the domains that you want to include in this link exclusion.
*   **CSS selector exclusion**: Exclude elements based on their CSS selector tagname, class id, or attribute.
    *   Enter the CSS target selector in the space provided.

Additional resources
--------------------

*   For more information, visit [Configure the scan](/node/58536)and [How to configure CMS integration](/web-governance/how-configure-cms-integration "How to configure a CMS integration").
*   For advanced instructions on this topic, visit:
    *   Web Governancedeveloper documentation on [CMS Integration](/node/57881)