A canonical URL is the preferred URL of a website’s homepage. Most homepages can be found by typing multiple URLs into a browser’s address bar.For example, all of the following URLs could contain the same homepage content for your website:http://yoursite.comhttps://yoursite.comhttp://www.yoursite.comhttps://www.yoursite.comIf you have set https://yoursite.com/ as the preferred URL, it becomes the canonical domain.
What is a Canonical URL in WordPress?
WordPress blog posts and pages have the same URL variation that we shared in our homepage example, and they can also be found using their post ID.For example, What Is WordPress Exapined For Starter: Site Scan blog post can be found using both of the following URLs:
Or By Post I’d:
Why is it Important to Set Canonical URLS in WordPress?While it is easy for us to see and treat both https://wpstarter.tech/what-is-wordpress-explained-for-starter/ and https://wpstarter.tech/?p=311 as the same piece of content, a bot or webcrawler will treat it as two separate blog posts from two different websites.The SEO Benefits of Defining Your Canonical URL and Domain Defining the canonical URL for every set of URLs lets Google and other search engines know that these similar but different URLs are the same. This prevents a Googlebot from spending time crawling multiple pages for a single piece of content and reduces the time it takes for Google to find and surface new and updated content.
Another SEO benefit of setting the canonical URL is that it allows you to decide how a search engine presents your content to potential visitors.Using our feature spotlight post example from earlier,https://wpstarter.tech/clone-duplicate-wordpress-post-free-2020/ has the title of the blog post in the URL and is more descriptive and welcoming than https://wpstarter.tech/?p=346
How Do I Check If My Canonical URL is Defined?The fastest way to check if you have defined your canonical domain is to view the page source of your website’s homepage. Load up your homepage in your favorite web browser and then right-click with your mouse and then select View Page Source.
The source page will display all of the different sources the page is pulling from, and the various HTML and CSS elements used to create the page. The source page will also reveal if the canonical domain was set using the rel=”canonical” link tag or HTTP header.Looking at the wpstarter.tech source page, we can see that we set the canonical domain to https://wpstarter.tech using the rel=”canonical” link tag. To set the canonical domain using the rel=”canonical” HTTP header we could have added Link: [https://](<http://www.example.com/downloads/white-paper.pdf>)wpstarter.tech; rel=”canonical” to the page’s header.
Another way to see if the canonical domain has been defined is to use Google’s URL Inspection Tool. You can find the tool inside your Google Search Console admin dashboard. Add your homepage URL in the search field and hit enter.
In the Coverage Summary , you will see the values of the User-declared canonical and Google-selected canonical. The User-declared canonical is the URL you set for your website. The Google-selected canonical is the URL selected by Google as the authoritative version of this page if you never defined the canonical URL for the page.
The screenshot above is the Google URL Inspection Tool results from a site that I have not defined the canonical domain, and that is so new Google hasn’t set a canonical domain.How Can I Set the Canonical URL For My WordPress Website?The easiest and fastest way to set the canonical URL is to use a WordPress SEO plugin like Yoast SEO or RankMath.If you are using Yoast SEO, for posts, pages, and custom post types, you can edit the canonical URL in the advanced tab of the Yoast SEO metabox.
Yoast SEO does an excellent job of auto-selecting the correct canonical URL for most posts and pages, but the plugin makes it easy to change if needed.If you are using the RankMath SEO plugin, you can edit the canonical URL in the advanced tab of the RankMath metabox.
Like Yoast SEO, RankMath will auto-set canonical URLs for you, but it also gives you an option to update it as needed.