Constructing URL Patterns
Introduction
URL patterns specified in the Start and Block URLs page control the URLs that the search appliance includes in the index. To configure the crawl, use the Content Sources > Web Crawl > Start and Block URLs page in the Admin Console to enter URLs and URL patterns in the following boxes:
The search appliance starts crawling from the URLs listed in the Start URLs text box. Each URL that the search appliance encounters is compared with URL patterns listed in the Follow Patterns and Do Not Follow Patterns text boxes.
A URL is included in the index when all of the following are true:
•
|
The URL is reachable through the URLs specified in the Start URLs field.
|
•
|
The URL matches at least one pattern in the Follow Patterns field.
|
•
|
The URL does not match an exception pattern in the Follow Patterns field.
|
•
|
The URL does not match a pattern in the Do Not Follow Patterns field.
|
•
|
The URL matches an exception in the Do Not Follow Patterns field.
|
Alternatively, URLs can be excluded from an index through the use of a robots.txt file or robots meta tags.
For complete information about the Start and Block URLs page, in the Admin Console, click Admin Console Help > Content Sources > Web Crawl > Start and Block URLs.
Rules for Valid URL Patterns
Any substring of a URL that includes the host/path separating slash |
Any page on www.google.com using the HTTP protocol. |
|||
Any page on www.google.com using any supported protocol. |
||||
Any page in the google.com domain. |
||||
Any suffix of a string. You specify the suffix with the $ at the end of the string. |
All pages ending with home.html. |
|||
Any prefix of a string. You specify the prefix with the ^ at the beginning of the string. A prefix can be used in combination with the suffix for exact string matches. For example, ^candy cane$ matches the exact string for “candy cane.” |
||||
An arbitrary substring of a URL. These patterns are specified using the prefix “contains”. |
||||
Any URL that contains “beans.com” such as http://blog.beans.com/ or http://www.page.com/?goto=beans.com/images |
||||
Exceptions denoted by - (minus) sign. |
Means that “www.chocolate.candy.com” is a match, but “www.candy.com” is not a match. |
|||
Regular expressions from the GNU Regular Expression library. In the search appliance, regular expressions:
Note: regexp: and regexpCase: are equivalent. |
See the GNU Regular Expression library (http://www.cs.utah.edu/dept/old/texinfo/regex/regex_toc.html) |
|||
Empty lines and comments starting with # are permissible. These comments are removed from the URL pattern and ignored. |
Comments in URL Patterns
#This is a comment.
Case Sensitivity
URL patterns are case sensitive. The following table uses www.example.com/ to illustrate an example that does not match the URL pattern, and another example that does match the pattern.
The Google Search Appliance treats URLs as case-sensitive, because URLs that differ only by case can legitimately be different pages. The hostname part of the URL, however, is case-insensitive. To capture URLs with variable case use a regular expression. More information about regular expressions, see Google Regular Expressions.
Simple URL Patterns
The following notation is used throughout this document:
Matching domains
Matching directories
The following example matches all URLs in the products directory and all sub-directories under products on the site sales.example.com.
sales.example.com/products/about.html |
The following example matches all URLs in the products directory and all sub-directories under products on all sites in the example.com domain.
accounting.example.com/products/prices.htm |
The following example matches all URLs in an images directory or sub-directory, in any side.
Note: If one of the pages on a site links to another external site or domain, this example would also match the /image/ directories of those external sites.
www.example1423.com/images/myVacation/ |
Matching files
/products/mypage.html |
Matching protocols
To match URLs that are accessible by a specific protocol, specify the protocol in the pattern. The following example matches HTTPS URLs that contain the products directory.
Matching ports
Note: If you explicitly include a port number, the pattern matches only URLs that explicitly include the port number, even if you use the default port. For example, a URL pattern that includes www.example.com:80/products/ does not match www.example.com/products/.
Using the prefix option
http://www.example.com/ |
Using the suffix option
To match the end of a URL, add the dollar ($) character to the end of the pattern.
The following example matches http://www.example.com/mypage.jhtml, but not http://www.example.com/mypage.jhtml;jsessionid=HDUENB2947WSSJ23.
The following example matches mypage.htm, but does not match mypage.html.
The following example is useful for specifying all files of a certain type, including .html, .doc, .ppt, and .gif.
Matching specific URLs
To exactly match a single URL, use both caret (^) and dollar ($). The following example matches only the URL: http://www.example.com/mypage.jhtml
Matching specified strings
To match URLs with a specified string use the contains: prefix. The following example matches any URL containing the string “product.”
SMB URL Patterns
In GSA release 7.4, on-board file system crawling (File System Gateway) is deprecated. For more information, see Deprecation Notices. |
To match SMB (Server Message Block) URLs, the pattern must have a fully-qualified domain name and begin with the smb: protocol. SMB URLs refer to objects that are available on SMB-based file systems, including files, directories, shares, and hosts. SMB URLs use only forward slashes. Some environments, such as Microsoft Windows, use backslashes (“\”) to separate file path components. However, for these URL patterns, you must use forward slashes. SMB paths to folders must end with a trailing forward slash (“/”).
The following example shows the correct structure of an SMB URL.
smb://<fully-qualified-domain-name>/<share>/<directory>/<file> |
|
The following SMB URL patterns are not supported:
•
|
URLs that omit the fully-qualified domain name, such as the following: smb://myshare/mydir/
|
•
|
URLs with workgroup identifiers in place of hostnames, such as the following: smb://workgroupID/myshare/
|
Exception Patterns
To specify exception patterns, prefix the expression with a hyphen (-). The following example includes sites in the example.com domain, but excludes secret.example.com.
The following example excludes any URL that contains content_type=calendar.
Google Regular Expressions
A Google regular expression describes a complex set of URLs. For more information on GNU regular expressions, see the Google Search for “gnu regular expression tutorial” (http://www.google.com/search?hl=en&q=gnu+regular+expression+tutorial). Google regular expressions are similar to GNU regular expressions, with the exception of the following differences:
•
|
A case insensitive expression starts with the following prefix: regexpIgnoreCase:
|
•
|
A case sensitive expression does not require a prefix, but the regexpCase: and regexp: prefixes can be used to specify case sensitivity.
|
•
|
The following example matches any URL that references an images directory on www.example.com using the HTTP protocol.
http://www.example.com/images/logo.gif |
The following example matches any URL in which the server name starts with auth and the URL contains .com.
http://auth.www.example.com/mypage.html |
This example does not match http://AUTH.engineering.example.com/mypage.html because the expression is case sensitive.
The following pattern matches JHTML pages from site www.example.com. These pages have the jsessionid, type=content parameters, and id.
http://www.example.com/page.jhtml;jsessionid= |
Note: Do not begin or end a URL pattern with period+asterisk (.*) if you are using the regexp: prefix, as this pattern is ineffective and may cause performance problems.
Note: Invalid regular expression patterns entered on the Content Sources > Web Crawl > Start and Block URLs page in the Admin Console can cause search appliance crawling to fail.
Using Backreferences with Do Not Follow Patterns
A backreference stores the part of a URL pattern matched by a part of a regular expression that is grouped within parentheses. The search appliance supports using backreferences with Do Not Follow Patterns. The Content Sources > Web Crawl > Start and Block URLs page in the Admin Console includes default backreferences in the Do Not Follow Patterns. The search appliance does not support using backreferences with Follow Patterns.
The following examples illustrate backreferences and are similar to the default backreferences on the Content Sources > Web Crawl > Start and Block URLs page. These backreferences prevent the search appliance from crawling repetitive URLs.
Controlling the Depth of a Crawl with URL Patterns
regexp:www\\.mysite\\.com/[^/]*$
regexp:www\\.mysite\\.com/[^/]*/[^/]*$
regexp:www\\.mysite\\.com/[^/]*/[^/]*/[^/]*$