Joomla site installed in subfolder - currentURL

  • Posts: 68
  • Thank you received: 6
11 years 7 months ago #98252

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/

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('"',"'",'<','>',';'),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 or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 7 months ago #98366

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 or Create an account to join the conversation.

  • Posts: 68
  • Thank you received: 6
11 years 7 months ago #99024

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

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum