[Skip to main content](#vessel-content)

#   Canonical URL and relative path

##

- **[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")**
- [![paddyrolls's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1931-paddyrolls "View paddyrolls's Profile") Topic Author
- [ Offline](/forum/user/1931-paddyrolls)

Less More

- Posts: 100
- Thank you received: 1
-
-

12 years 4 months ago -  12 years 4 months ago [\#164795](#164795) by [paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")  *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#164795 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")* was created by *[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")*

-- 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/](http://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](http://www.roarpilates.com.au/dev_j3/community-pilates-classes/find-a-class/product/233-corebasicspaddy.html), as I have specified a relative url without the starting "/".

Thanks

Patrick

Last edit: 12 years 4 months ago by [paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 4 months ago [\#164823](#164823) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#164823 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")*

Hi,

Thanks for the report, we corrected it on our end.
First of all, thanks to edit the $live_site value to have

> [ www.roarpilates.com.au/dev\_j3/](http://www.roarpilates.com.au/dev_j3/)

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']) &amp;&amp; $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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")**
- [![paddyrolls's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1931-paddyrolls "View paddyrolls's Profile") Topic Author
- [ Offline](/forum/user/1931-paddyrolls)

Less More

- Posts: 100
- Thank you received: 1
-
-

12 years 4 months ago [\#164910](#164910) by [paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")  Replied by *[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")* on topic *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#164910 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")*

HI Xavier

Great that works.

Thanks for the response.

Patrick

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")**
- [![paddyrolls's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1931-paddyrolls "View paddyrolls's Profile") Topic Author
- [ Offline](/forum/user/1931-paddyrolls)

Less More

- Posts: 100
- Thank you received: 1
-
-

12 years 3 months ago [\#166286](#166286) by [paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")  Replied by *[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")* on topic *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#166286 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")*

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/](http://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/](http://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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 3 months ago -  12 years 3 months ago [\#168986](#168986) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#168986 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")*

Hi,

Could you try to add: Code:

if(preg_match('#'.$parsedCurrent['path'].'#',$endUrl)){ $parsedCurrent['path'] = ''; }

Just before: Code:

$cleanUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$parsedCurrent['path'].$endUrl;

Last edit: 12 years 3 months ago by [Xavier](/forum/user/4105-xavier "View Xavier's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")**
- [![paddyrolls's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1931-paddyrolls "View paddyrolls's Profile") Topic Author
- [ Offline](/forum/user/1931-paddyrolls)

Less More

- Posts: 100
- Thank you received: 1
-
-

12 years 2 months ago [\#169486](#169486) by [paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")  Replied by *[paddyrolls](/forum/user/1931-paddyrolls "View paddyrolls's Profile")* on topic *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#169486 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")*

Hi Xavier

Unfortunately that did not work.

Just to be clear I am refering to the Canonical URL that is generated in the product setup when I have enabled "Use canonical URL and generate if it is missing" in hikashop configuration

[ ![CanonicalURL.png](/forum/attachment/19278) ](/forum/attachment/19278 "CanonicalURL.png")

Thanks

Patrick

- [ ![CanonicalURL.png](/forum/attachment/19278) ](/forum/attachment/19278 "CanonicalURL.png") [ ](/forum/attachment/19278?download=1 "CanonicalURL.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 2 months ago [\#169573](#169573) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Canonical URL and relative path](/forum/26-product-category-display/869834-canonical-url-and-relative-path#169573 "-- 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&#95;site = '  www.roarpilates.com.au/dev&#95;j3/ ;'  I have set a product with a canonical url to be &quot;community-pilates-classes/find-a-class/product/233-corebasicspaddy.html&quot; (without quotes)  When I select the product, the &quot;dev&#95;j3&quot; is removed?  Should it not append the canonical url to   www.roarpilates.com.au/dev&#95;j3/community-...corebasicspaddy.html , as I have specified a relative url without the starting &quot;/&quot;.  Thanks  Patrick")*

Hi,

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 .= '&amp;tmpl=component'; $ret = JRoute::_('index.php?option='.HIKASHOP_COMPONENT.'&amp;ctrl='.$link,!$redirect); $ret = str_replace('dev_j3/dev_j3','dev_j3';$ret); if($js) return str_replace('&amp;amp;', '&amp;', $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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Njk4MzQtY2Fub25pY2FsLXVybC1hbmQtcmVsYXRpdmUtcGF0aD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.066 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
