PDA

View Full Version : Double domain in canonical



Noam Peer
February 28, 2017, 07:20 AM
Hello

Today found this bug with the canonical url.
2200

How can I fix this?

Thank you

Viktor
February 28, 2017, 11:45 AM
Hello Noam Peer,

Would you please find code for canonical in file: ftp://includes>>controllers>>listing_type.inc.php at line ~305

and replace to my:



// canonical link generation
if ($config['mod_rewrite'] && (is_numeric(strpos($_SERVER['REQUEST_URI'], '?')) || $_SESSION['browse_sort_by']) || $_GET['pg']) {
if ($GLOBALS['geo_filter_data']['geo_url']) {
$page_info['canonical'] = str_replace('[geo_url]', '', $GLOBALS['geo_filter_data']['clean_url']);
$page_info['canonical'] = preg_replace('/\?(.+)$/', '', $page_info['canonical']);
} else {
$sheme = ($_SERVER['REQUEST_SCHEME'] ?: 'http') ."://";
$current_url = $sheme.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$request_url = str_replace(SEO_BASE, '', $current_url);

if ($_GET['pg']) {
$request_url = preg_replace('#index[0-9]+/$#smi', '', $request_url);
}
$page_info['canonical'] = SEO_BASE . ltrim(preg_replace('/\?(.+)$/', '', $request_url), '/');
}
}

save and check again.

Would you please send ftp access to my PM if you want me to do it.

Noam Peer
February 28, 2017, 01:02 PM
Hello Viktor

Also need to be changed http to https in this string
$sheme = ($_SERVER['REQUEST_SCHEME'] ?: 'http') ."://";

Everithing is working now.
Thank you

Christian Evequoz
August 1, 2017, 11:58 AM
Hi Viktor, has this have anything to do with my issue? Google search is giving www.gulfbusters.com/united-arab-emirates link when should only be www.gulfbusters.com.

How to fix that? I am not using country wise in my site.
2483

Viktor
August 1, 2017, 12:43 PM
Hello Christian,

I think you should update sitemap.xml in google webmaster tools -> https://www.google.com/webmasters/tools/

Crawl -> Sitemaps

https://www.screencast.com/t/3hUAgLnFZ

Christian Evequoz
August 2, 2017, 03:59 AM
HI Viktor, Yes I did that and it ok now. Thanks!!