Totally Zenned
- Join Date:
- Nov 2007
- Location:
- Woodbine, Georgia, United States
- Posts:
- 4,305
- Plugin Contributions:
- 39
Google Alternate page with proper canonical tag Error
1.5.8 & php 7.3
I have been receiving reports recently... Likely a Google change, because the shop has been live without changes for a very long time, is well indexed & ranked. Google search console is giving me the "Alternate page with proper canonical tag" error.
Here is the reason
This url
index.php?main_page=product_info&cPath=67_645_118_676&products_id=37819
has the following canonical tag
<link href="https://www.xxxxxx.com/index.php?main_page=product_info&[B]amp;[/B]products_id=37819" rel="canonical">
Although, this is the first time I've seen this, it exists on several sites I manage. The escaped ampersand in the url creates the difference. I have temporarily patched this by editing html_output line 98
from
$link = preg_replace('/&/', '&', $link);
to
$link = preg_replace('/&/', '&', $link);
for the sake of testing. I think this will likely need a patch, as the correct representation of an ampersand in a url is unescaped.
I chose this manor because the generated links for structured data are also fixed.
Any ideas?
~Melanie