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

#   Canonical URL on MAMP generates incorrectly

##

- **[helenbn](/forum/user/6015-helenbn "View helenbn's Profile")**
- [![helenbn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6015.jpg)](/forum/user/6015-helenbn "View helenbn's Profile") Topic Author
- [ Offline](/forum/user/6015-helenbn)

Less More

- Posts: 33
- Thank you received: 0
-
-
- [](http://prettygooddesigns.com)
-

11 years 2 months ago [\#213731](#213731) by [helenbn](/forum/user/6015-helenbn "View helenbn's Profile")  *[Canonical URL on MAMP generates incorrectly](/forum/26-product-category-display/879191-canonical-url-on-mamp-generates-incorrectly#213731 "-- 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")* was created by *[helenbn](/forum/user/6015-helenbn "View helenbn's Profile")*

-- 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

---

Pretty Good Designs \| [ prettygooddesigns.com](http://prettygooddesigns.com) \| Hey, that's pretty good!

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

11 years 2 months ago [\#213737](#213737) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Canonical URL on MAMP generates incorrectly](/forum/26-product-category-display/879191-canonical-url-on-mamp-generates-incorrectly#213737 "-- 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")*

Hi,

Thank you for your feedback.
Change the code: Code:

if(!empty($parsedCurrent['port']) &amp;&amp; $parsedCurrent['port']!= 80){ $endUrl = ':'.$parsedCurrent['port'].$endUrl; } if(isset($parsedCurrent['path']) &amp;&amp; !preg_match('#^/?'.$parsedCurrent['path'].'#',$endUrl)) $parsedCurrent['path'] = preg_replace('#/$#','',$parsedCurrent['path']); else $parsedCurrent['path'] = ''; $cleanUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$parsedCurrent['path'].$endUrl; return $cleanUrl;

to: Code:

$port = ''; if(!empty($parsedCurrent['port']) &amp;&amp; $parsedCurrent['port']!= 80){ $port = ':'.$parsedCurrent['port']; } if(isset($parsedCurrent['path']) &amp;&amp; !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;

in the file administrator/components/com_hikashop/helpers/helper.php and that should fix the problem.

The following user(s) said Thank You: [helenbn](/forum/user/6015-helenbn "View helenbn's Profile")

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

- **[helenbn](/forum/user/6015-helenbn "View helenbn's Profile")**
- [![helenbn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6015.jpg)](/forum/user/6015-helenbn "View helenbn's Profile") Topic Author
- [ Offline](/forum/user/6015-helenbn)

Less More

- Posts: 33
- Thank you received: 0
-
-
- [](http://prettygooddesigns.com)
-

11 years 2 months ago [\#213801](#213801) by [helenbn](/forum/user/6015-helenbn "View helenbn's Profile")  Replied by *[helenbn](/forum/user/6015-helenbn "View helenbn's Profile")* on topic *[Canonical URL on MAMP generates incorrectly](/forum/26-product-category-display/879191-canonical-url-on-mamp-generates-incorrectly#213801 "-- 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")*

Thank you for the quick fix! This works perfectly!!

---

Pretty Good Designs \| [ prettygooddesigns.com](http://prettygooddesigns.com) \| Hey, that's pretty good!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84NzkxOTEtY2Fub25pY2FsLXVybC1vbi1tYW1wLWdlbmVyYXRlcy1pbmNvcnJlY3RseT90bXBsPW1hcmtkb3du) 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.047 seconds

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