How to Set a Canonical URL
Add a canonical tag so search engines treat one URL as the original when the same page is reachable at several addresses.
The same page is often reachable at more than one address: with and without www, with a trailing slash, with tracking parameters, over http and https. Search engines see each as a separate page and split the ranking between them. A canonical tag tells them which one counts.
Pick the one true URL for each page
Decide on a single format and use it everywhere: https, with or without www (pick one), and with or without a trailing slash (pick one). For example:
https://yourdomain.com/about
Every internal link, sitemap entry, and redirect should use this exact form.
Add the canonical tag to the head
Inside <head> on every page, add a link tag pointing at that page's true URL:
<link rel="canonical" href="https://yourdomain.com/about" />
The URL must be absolute, including the scheme and domain. Relative paths are ignored by some crawlers.
Make every page self-referencing
A page's canonical should point at itself, not at the homepage or a category. about points to about. Pointing many pages at one URL tells Google those pages are duplicates and drops them from results.
The exceptions are true duplicates: a print version, a ?ref= tracking variant, or a syndicated copy. Those point at the original.
Redirect the other versions
A canonical is a hint. A redirect is a rule. Set your server or host to 301-redirect http to https and www to non-www (or the reverse) so the alternate addresses do not exist as separate pages at all.
Check it in Search Console
Paste a URL into the search bar at the top of Google Search Console. The Page indexing section shows the User-declared canonical (yours) and the Google-selected canonical (what Google decided). They should match. If they do not, Google is seeing a conflict somewhere, usually a redirect or sitemap that disagrees with the tag.
One per page. If a page has two canonical tags, Google ignores both. Check for a CMS or plugin adding one you did not know about.
More Websites how-tos
- How to Add a Favicon to a Website
- How to Add a Website to Bing Webmaster Tools
- How to Add a Website to Google Search Console
- How to Add Alt Text to Images
- How to Add Google Analytics to a Website
- How to Add Open Graph Tags to a Website
- How to Add Structured Data to a Web Page
- How to Check DNS Propagation
- How to Check If a Website Is Indexed by Google
- How to Compress Images for a Website
- How to Connect a Domain to Vercel
- How to Create a Sitemap for a Website
- How to Make a Website Mobile-Friendly
- How to Move a Domain to Cloudflare DNS
- How to Redirect www to non-www
- How to Set Up a 301 Redirect
- How to Set Up Email Forwarding for a Domain
- How to Write a Meta Description
- How to Write a robots.txt File