- Posts: 68
- Thank you received: 6
Joomla site installed in subfolder - currentURL
13 years 5 months ago #98252
by cbadmin
Joomla site installed in subfolder - currentURL was created by cbadmin
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
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.
13 years 5 months ago #98366
by nicolas
Replied by nicolas on topic Joomla site installed in subfolder - currentURL
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.
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.
13 years 5 months ago #99024
by cbadmin
Replied by cbadmin on topic Joomla site installed in subfolder - currentURL
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.
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.
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds