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

#   Joomla site installed in subfolder - currentURL

##

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

Less More

- Posts: 68
- Thank you received: 6
-
-

13 years 6 months ago [\#98252](#98252) by [cbadmin](/forum/user/15476-cbadmin "View cbadmin's Profile")  *[Joomla site installed in subfolder - currentURL](/forum/3-bug-report/80171-joomla-site-installed-in-subfolder-currenturl#98252 "We have a website installed in a subfolder and using mod&#95;rewrite to avoid having the /subfolder in the URL as described on this page   www.jayway.com/2009/01/31/how-to-get-you...y-to-work-at-onecom/  The problem is that in this particular hosting configuration the function hikashop&#95;currentURL() returns values starting with /subfolder and therefore all related functionalities do not work such as Pagination, Currency switch, etc...  We have done a quick fix in the file administrator/components/com&#95;hikashop/helpers/helper.php  At the end of the function hikashop&#95;currentURL($checkInRequest='',$safe=true) add the 1 line below by replacing /subfolder with your actual subfolder name  # @@@@@ BEGIN - QUICKFIX if (strpos($result,&quot;/subfolder&quot;) != false) $result = str&#95;replace(&quot;/subfolder&quot;, &quot;&quot;, $result); # @@@@@ END - QUICKFIX if($safe){ $result = str&#95;replace(array('&quot;',&quot;'&quot;,'',';'),array('%22','%27','%3C','%3E','%3B'),$result); }  It would be more elegant if the /subfolder could be a parameter in the System / Configuration screen.  -Max")* was created by *[cbadmin](/forum/user/15476-cbadmin "View cbadmin's Profile")*

We have a website installed in a subfolder and using mod_rewrite to avoid having the /subfolder in the URL as described on this page
[ www.jayway.com/2009/01/31/how-to-get-you...y-to-work-at-onecom/](http://www.jayway.com/2009/01/31/how-to-get-your-joomla-in-a-sub-directory-to-work-at-onecom/)

The problem is that in this particular hosting configuration the function hikashop_currentURL() returns values starting with /subfolder and therefore all related functionalities do not work such as Pagination, Currency switch, etc...

We have done a quick fix in the file administrator/components/com_hikashop/helpers/helper.php

At the end of the function hikashop_currentURL($checkInRequest='',$safe=true) add the 1 line below by replacing /subfolder with your actual subfolder name

\# @@@@@ BEGIN - QUICKFIX
if (strpos($result,"/subfolder") != false) $result = str_replace("/subfolder", "", $result);
\# @@@@@ END - QUICKFIX
if($safe){
$result = str_replace(array('"',"'",'&lt;','&gt;',';'),array('%22','%27','%3C','%3E','%3B'),$result);
}

It would be more elegant if the /subfolder could be a parameter in the System / Configuration screen.

-Max

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84MDE3MS1qb29tbGEtc2l0ZS1pbnN0YWxsZWQtaW4tc3ViZm9sZGVyLWN1cnJlbnR1cmw/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86321
- Thank you received: 14279
-
-

13 years 6 months ago [\#98366](#98366) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Joomla site installed in subfolder - currentURL](/forum/3-bug-report/80171-joomla-site-installed-in-subfolder-currenturl#98366 "We have a website installed in a subfolder and using mod&#95;rewrite to avoid having the /subfolder in the URL as described on this page   www.jayway.com/2009/01/31/how-to-get-you...y-to-work-at-onecom/  The problem is that in this particular hosting configuration the function hikashop&#95;currentURL() returns values starting with /subfolder and therefore all related functionalities do not work such as Pagination, Currency switch, etc...  We have done a quick fix in the file administrator/components/com&#95;hikashop/helpers/helper.php  At the end of the function hikashop&#95;currentURL($checkInRequest='',$safe=true) add the 1 line below by replacing /subfolder with your actual subfolder name  # @@@@@ BEGIN - QUICKFIX if (strpos($result,&quot;/subfolder&quot;) != false) $result = str&#95;replace(&quot;/subfolder&quot;, &quot;&quot;, $result); # @@@@@ END - QUICKFIX if($safe){ $result = str&#95;replace(array('&quot;',&quot;'&quot;,'',';'),array('%22','%27','%3C','%3E','%3B'),$result); }  It would be more elegant if the /subfolder could be a parameter in the System / Configuration screen.  -Max")*

Hi,

In that case the best would be to have a joomla system plugin implementing the onAfterRoute trigger to properly set the $_SERVER variables of PHP so that HikaShop and the other extensions relying on $_SERVER to know the current URL will directly get the proper URL.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84MDE3MS1qb29tbGEtc2l0ZS1pbnN0YWxsZWQtaW4tc3ViZm9sZGVyLWN1cnJlbnR1cmw/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 68
- Thank you received: 6
-
-

13 years 6 months ago [\#99024](#99024) by [cbadmin](/forum/user/15476-cbadmin "View cbadmin's Profile")  Replied by *[cbadmin](/forum/user/15476-cbadmin "View cbadmin's Profile")* on topic *[Joomla site installed in subfolder - currentURL](/forum/3-bug-report/80171-joomla-site-installed-in-subfolder-currenturl#99024 "We have a website installed in a subfolder and using mod&#95;rewrite to avoid having the /subfolder in the URL as described on this page   www.jayway.com/2009/01/31/how-to-get-you...y-to-work-at-onecom/  The problem is that in this particular hosting configuration the function hikashop&#95;currentURL() returns values starting with /subfolder and therefore all related functionalities do not work such as Pagination, Currency switch, etc...  We have done a quick fix in the file administrator/components/com&#95;hikashop/helpers/helper.php  At the end of the function hikashop&#95;currentURL($checkInRequest='',$safe=true) add the 1 line below by replacing /subfolder with your actual subfolder name  # @@@@@ BEGIN - QUICKFIX if (strpos($result,&quot;/subfolder&quot;) != false) $result = str&#95;replace(&quot;/subfolder&quot;, &quot;&quot;, $result); # @@@@@ END - QUICKFIX if($safe){ $result = str&#95;replace(array('&quot;',&quot;'&quot;,'',';'),array('%22','%27','%3C','%3E','%3B'),$result); }  It would be more elegant if the /subfolder could be a parameter in the System / Configuration screen.  -Max")*

Good news it appears that putting
RewriteBase / in the ~/public_html/subfolder/.htaccess is enough and then no modification of Hikashop code is needed.

It works because in this particular case we have 2 .htaccess

1) ~/public_html/.htaccess
2) ~/public_html/subfolder/.htaccess

The rules in 1) make Joomla believe it is installed in /
Therefore the proper RewriteBase in 2) is in fact / and not /subfolder

Hikashop was correct to interpret my initially wrong RewriteBase.

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile"), [roffez](/forum/user/34088-roffez "View roffez's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84MDE3MS1qb29tbGEtc2l0ZS1pbnN0YWxsZWQtaW4tc3ViZm9sZGVyLWN1cnJlbnR1cmw/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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.094 seconds

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

[](#top)
