Canonical URL on MAMP generates incorrectly
11 years 3 weeks ago #213731
by helenbn
Pretty Good Designs | prettygooddesigns.com | Hey, that's pretty good!
Canonical URL on MAMP generates incorrectly was created by helenbn
-- url of the page with the problem -- : http://localhost:8888/mysite/
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.4.10
-- Browser(s) name and version -- : FireFox 40.0.3
Hi,
The Canonical URL generates incorrectly when on MAMP.
My site begins http://localhost:8888/mysite/...
but the Canonical URL generates http://localhost/mysite:8888/...
I need help with this.
Thanks,
Helen
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.4.10
-- Browser(s) name and version -- : FireFox 40.0.3
Hi,
The Canonical URL generates incorrectly when on MAMP.
My site begins http://localhost:8888/mysite/...
but the Canonical URL generates http://localhost/mysite:8888/...
I need help with this.
Thanks,
Helen
Pretty Good Designs | prettygooddesigns.com | Hey, that's pretty good!
Please Log in or Create an account to join the conversation.
11 years 3 weeks ago #213737
by nicolas
Replied by nicolas on topic Canonical URL on MAMP generates incorrectly
Hi,
Thank you for your feedback.
Change the code:
to:
in the file administrator/components/com_hikashop/helpers/helper.php and that should fix the problem.
Thank you for your feedback.
Change the code:
Code:
if(!empty($parsedCurrent['port']) && $parsedCurrent['port']!= 80){
$endUrl = ':'.$parsedCurrent['port'].$endUrl;
}
if(isset($parsedCurrent['path']) && !preg_match('#^/?'.$parsedCurrent['path'].'#',$endUrl))
$parsedCurrent['path'] = preg_replace('#/$#','',$parsedCurrent['path']);
else
$parsedCurrent['path'] = '';
$cleanUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$parsedCurrent['path'].$endUrl;
return $cleanUrl;
Code:
$port = '';
if(!empty($parsedCurrent['port']) && $parsedCurrent['port']!= 80){
$port = ':'.$parsedCurrent['port'];
}
if(isset($parsedCurrent['path']) && !preg_match('#^/?'.$parsedCurrent['path'].'#',$endUrl))
$parsedCurrent['path'] = preg_replace('#/$#','',$parsedCurrent['path']);
else
$parsedCurrent['path'] = '';
$cleanUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$port.$parsedCurrent['path'].$endUrl;
return $cleanUrl;
The following user(s) said Thank You: helenbn
Please Log in or Create an account to join the conversation.
11 years 3 weeks ago #213801
by helenbn
Pretty Good Designs | prettygooddesigns.com | Hey, that's pretty good!
Replied by helenbn on topic Canonical URL on MAMP generates incorrectly
Thank you for the quick fix! This works perfectly!!
Pretty Good Designs | prettygooddesigns.com | Hey, that's pretty good!
Please Log in or Create an account to join the conversation.
Time to create page: 0.161 seconds