Canonical URL includes full scheme, hostname, path and optionally: URL segments, page numbers and query string.
Available since version 3.0.155.
Usage
// basic usage
$string = $input->canonicalUrl();
// usage with all arguments
$string = $input->canonicalUrl(array $options = []);
Arguments
Name | Type(s) | Description |
---|
$options (optional) | array | scheme (string|bool): Scheme "https", "http", or omit to auto-detect Default:''host (string): Hostname or omit to use current http host Default:''page (Page): Page to use for URL or omit for current Page Default:$pageurlSegments (array|string|bool): True to include current URL segments, false to disable, or specify array or string of URL segments to use Default:truenotSegments (array|string): Full URL segments or patterns (wildcard or regex) to exclude from canonical URL Default:[]pageNum (bool|int): True to include current page/pagination number, false to disable, or specify pagination number (int) to use Default:truequeryString (bool|string|array): True to use current whitelist query string, false to disable,
or specify array of query string vars, or actual query string as string Default:truelanguage (bool|Language): True for current language, false to force default or no language,
or specify Language object to use that language. Default:true
|
Return value
$input methods and properties
API reference based on ProcessWire core version 3.0.251