Case Studies of a Freelance Website Programmer
The Case of the Confusing Canonical
A recent customer contacted me asking for help getting indexed by search engines, they said they weren’t indexed at all after having a website for a few years with a good few inbound links.
Sure enough, searching for their domain name showed just one result, quite a disappointing prospect for any internet-based business relying on visits for income. While this one took about 5 minutes to solve, I can see more people falling into this trap if they don’t quite know what’s happening.
Each webpage can have what’s called a canonical link in the
<head> section of the source code, lets take this page for example, it looks like this:
<link rel="canonical" href="https://ukinet.co.uk/case-studies">
What it means is that this page's content comes from the page https://ukinet.co.uk/case-studies Some web-based CMS’s that make it easier for people to create their own webpage allow the user to configure these canonical links.
They can also configure the URL to strip www from the domain name and redirect the page to the version without the www, for instance, if you entered https://www.ukinet.co.uk/ for this site, it would redirect your browser to https://ukinet.co.uk/, quite a common and trendy thing to do nowadays.
Now the problem was that the canonical link on each page was set to the www version of the webpage and the server redirected the user to the non www version, as far as search engines are concerned the source page is https://www.ukinet.co.uk, but that page doesn’t exist, so it won't get indexed, search engines count https://www.ukinet.co.uk and https://ukinet.co.uk as different pages.