Read the canonical tag of a page with curl
check canonical url of a page | show rel canonical command line | find wrong canonical tag | what is the canonical url of this page | curl | canonical | html | seocurl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<link[^>]*canonical[^>]*>'Loads the HTML, joins it into a single line and prints the <link rel="canonical"> element. The canonical should point to the page’s own reachable URL with status 200, not to a redirect, a staging domain or the http variant. More than one line in the output indicates duplicate canonicals, which Google then ignores.
Note: A canonical can also be sent as an HTTP header Link: <...>; rel="canonical", which curl -sI {{URL}} | grep -i '^link:' shows.
Also searched as
- check canonical url of a page
- show rel canonical command line
- find wrong canonical tag
- what is the canonical url of this page