Hi All,
I hope everyone is well. So I enabled Full Friendly URLs, but Google reports many duplicate content in Search Console.
For eg. https://mydomain.com and https://mydomain.com/index.php have the same content.
https://mydomain.com/login and https://mydomain.com/index.php/login and many others.
My question is, Is there a way to prevent the duplicate content issue with Google by removing index.php from URLs when Full Friendly URLs are enabled?
I must note that I have a hook file that helps make links canonical and is pasted below:
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
add_hook('ClientAreaHeadOutput', 1, function($vars)
{
$SystemURL = 'https://mydomain.com';
$url = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = strtok($url, '?');
return <<<HTML
<link rel="canonical" href="{$url}"/>
HTML;
});
Thank you.
Kind regards.