diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 0ab35c55fd8..ce1f27b49fc 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -196,7 +196,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) else dol_print_error($db); } // Add canonical reference - $tplcontent .= ''."\n"; + if ($object->virtualhost) { + $tplcontent .= ''."\n"; + } // Add manifest.json on homepage $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; $tplcontent .= ''."\n"; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 4f7cba09e89..70cfe780f55 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -681,6 +681,7 @@ if ($action == 'addcontainer') //$objectpage->htmlheader = preg_replace('/]*>\n/ims', '', $objectpage->htmlheader); + $objectpage->htmlheader = preg_replace('/]*rel="alternate[^>]*>\n/ims', '', $objectpage->htmlheader); $objectpage->htmlheader = preg_replace('/]*rel="canonical[^>]*>\n/ims', '', $objectpage->htmlheader); // Now loop to fetch JS @@ -1155,7 +1156,8 @@ if ($action == 'updatecss') if (GETPOSTISSET('virtualhost')) { - if (GETPOST('virtualhost', 'alpha') && !preg_match('/^http/', GETPOST('virtualhost', 'alpha'))) + $tmpvirtualhost = preg_replace('/\/$/', '', GETPOST('virtualhost', 'alpha')); + if ($tmpvirtualhost && !preg_match('/^http/', $tmpvirtualhost)) { $error++; setEventMessages($langs->trans('ErrorURLMustStartWithHttp', $langs->transnoentitiesnoconv("VirtualHost")), null, 'errors'); @@ -1169,7 +1171,7 @@ if ($action == 'updatecss') $arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only } - $object->virtualhost = GETPOST('virtualhost', 'alpha'); + $object->virtualhost = $tmpvirtualhost; $object->lang = GETPOST('WEBSITE_LANG', 'aZ09'); $object->otherlang = join(',', $arrayotherlang); $object->use_manifest = GETPOST('use_manifest', 'alpha');