- Posts: 100
- Thank you received: 1
Canonical URL and relative path
- paddyrolls
-
Topic Author
- Offline
Less
More
12 years 2 months ago - 12 years 2 months ago #164795
by paddyrolls
Canonical URL and relative path was created by paddyrolls
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.1
-- PHP version -- : 5x
HI
I have a development website with live url set to : $live_site = ' www.roarpilates.com.au/dev_j3/ ;'
I have set a product with a canonical url to be "community-pilates-classes/find-a-class/product/233-corebasicspaddy.html" (without quotes)
When I select the product, the "dev_j3" is removed?
Should it not append the canonical url to www.roarpilates.com.au/dev_j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting "/".
Thanks
Patrick
-- Joomla version -- : 3.3.1
-- PHP version -- : 5x
HI
I have a development website with live url set to : $live_site = ' www.roarpilates.com.au/dev_j3/ ;'
I have set a product with a canonical url to be "community-pilates-classes/find-a-class/product/233-corebasicspaddy.html" (without quotes)
When I select the product, the "dev_j3" is removed?
Should it not append the canonical url to www.roarpilates.com.au/dev_j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting "/".
Thanks
Patrick
Last edit: 12 years 2 months ago by paddyrolls.
Please Log in or Create an account to join the conversation.
12 years 2 months ago #164823
by Xavier
Replied by Xavier on topic Canonical URL and relative path
Hi,
Thanks for the report, we corrected it on our end.
First of all, thanks to edit the $live_site value to have
Thanks for the report, we corrected it on our end.
First of all, thanks to edit the $live_site value to have
Then thanks to edit the file "administrator/components/com_hikashop/helpers/helper.php" and replace the function "hikashop_cleanUrl()" by:
Code:
function hikashop_cleanURL($url, $forceInternURL=false){
$parsedURL = parse_url($url);
$parsedCurrent = parse_url(JURI::base());
if($forceInternURL==false){
if(isset($parsedURL['scheme'])){
return $url;
}
}
if(preg_match('#https?://#',$url)){
return $url;
}
if(preg_match('#www.#',$url)){
return $parsedCurrent['scheme'].'://'.$url;
}
if($parsedURL['path'][0]!='/'){
$parsedURL['path']='/'.$parsedURL['path'];
}
if(!isset($parsedURL['query']))
$endUrl = $parsedURL['path'];
else
$endUrl = $parsedURL['path'].'?'.$parsedURL['query'];
if(!empty($parsedCurrent['port']) && $parsedCurrent['port']!= 80){
$endUrl = ':'.$parsedCurrent['port'].$endUrl;
}
if(preg_match('#.*/#',$parsedCurrent['path'])){
$parsedCurrent['path'] = preg_replace('#/$#','',$parsedCurrent['path']);
}
$cleanUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$parsedCurrent['path'].$endUrl;
return $cleanUrl;
}
Please Log in or Create an account to join the conversation.
- paddyrolls
-
Topic Author
- Offline
Less
More
- Posts: 100
- Thank you received: 1
12 years 2 months ago #164910
by paddyrolls
Replied by paddyrolls on topic Canonical URL and relative path
HI Xavier
Great that works.
Thanks for the response.
Patrick
Great that works.
Thanks for the response.
Patrick
Please Log in or Create an account to join the conversation.
- paddyrolls
-
Topic Author
- Offline
Less
More
- Posts: 100
- Thank you received: 1
12 years 2 months ago #166286
by paddyrolls
Replied by paddyrolls on topic Canonical URL and relative path
HI
I thought this was solved but I came across another issue.
In hikashop configuration, I have set under SEF url options Force canonical URLs on listings to "Use canonical URL and generate if it is missing"
I have set the $live_site = ' www.roarpilates.com.au/dev_j3/ '
However, when the canonical urls are automatically generate it puts in "/dev_j3/community-pilates-classes/find-a-community-class/product/233-corebasics.html"
This means when the product is accessed, the following happens:
www.roarpilates.com.au/ dev_j3/dev_j3/community-pilates-classes/find-a-community-class/product/233-corebasics.html
Should it not automatically just add the "community-pilates-classes/find-a-community-class/product/233-corebasics.html" because "dev_j3" is inclued in $live_site.
Thanks
Patrick
I thought this was solved but I came across another issue.
In hikashop configuration, I have set under SEF url options Force canonical URLs on listings to "Use canonical URL and generate if it is missing"
I have set the $live_site = ' www.roarpilates.com.au/dev_j3/ '
However, when the canonical urls are automatically generate it puts in "/dev_j3/community-pilates-classes/find-a-community-class/product/233-corebasics.html"
This means when the product is accessed, the following happens:
www.roarpilates.com.au/ dev_j3/dev_j3/community-pilates-classes/find-a-community-class/product/233-corebasics.html
Should it not automatically just add the "community-pilates-classes/find-a-community-class/product/233-corebasics.html" because "dev_j3" is inclued in $live_site.
Thanks
Patrick
Please Log in or Create an account to join the conversation.
12 years 1 month ago - 12 years 1 month ago #168986
by Xavier
Replied by Xavier on topic Canonical URL and relative path
Hi,
Could you try to add:
Just before:
Could you try to add:
Code:
if(preg_match('#'.$parsedCurrent['path'].'#',$endUrl)){
$parsedCurrent['path'] = '';
}
Code:
$cleanUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$parsedCurrent['path'].$endUrl;
Last edit: 12 years 1 month ago by Xavier.
Please Log in or Create an account to join the conversation.
- paddyrolls
-
Topic Author
- Offline
Less
More
- Posts: 100
- Thank you received: 1
12 years 1 month ago #169486
by paddyrolls
Replied by paddyrolls on topic Canonical URL and relative path
Please Log in or Create an account to join the conversation.
12 years 1 month ago #169573
by Xavier
Replied by Xavier on topic Canonical URL and relative path
Hi,
In your case, could you edit the "hikashop_completeLink()" function to:
It's a temporary fix, I will try to reproduce the full problem on my end in order to find the best solution to fix it.
In your case, could you edit the "hikashop_completeLink()" function to:
Code:
function hikashop_completeLink($link,$popup = false,$redirect = false, $js = false){
if($popup) $link .= '&tmpl=component';
$ret = JRoute::_('index.php?option='.HIKASHOP_COMPONENT.'&ctrl='.$link,!$redirect);
$ret = str_replace('dev_j3/dev_j3','dev_j3';$ret);
if($js) return str_replace('&', '&', $ret);
return $ret;
}
It's a temporary fix, I will try to reproduce the full problem on my end in order to find the best solution to fix it.
Please Log in or Create an account to join the conversation.
Time to create page: 0.237 seconds